CREATE view view_User_Summary as Select * from(Select candiid ,(Select count(*) from FunnyPicLikes Where FunnyPicLikes.candiid=cn.CANDIid) as FunnyPicLikes ,(Select count(*) from JokeLikes Where JokeLikes.candiid=cn.CANDIid) as JokeLikes ,(Select count(*) from photoAlbumsPicsLikes Where photoAlbumsPicsLikes.candiid=cn.CANDIid) as photoAlbumsPicsLikes ,(Select count(*) from FunnyPictures Where mid=cn.CANDIid) as FunnyPictures ,(Select count(*) from Photos Where Photos.Candiid=cn.CANDIid) as Photos ,(Select count(*) from photoAlbums Where photoAlbums.candiid=cn.CANDIid) as photoAlbums ,(Select count(*) from OnlinePoleTest_Master Where CreationLogInId=cn.CANDIid) as OnlinePoleTest_Master ,(Select COUNT(*) from friendshiprequest where (toCANDIid=cn.CANDIid OR fromCANDIid=cn.CANDIid) AND isapproved='Y') as FCOUNT from candidatesRegistration cn ) as a where FunnyPicLikes >0 OR JokeLikes>0 OR photoAlbumsPicsLikes>0 OR FunnyPictures> 0 OR Photos>0 OR photoAlbums>0 OR OnlinePoleTest_Master>0 OR FCOUNT>0
Hi Everyone
I have to retrieve summary of user i.e. count of every records in each table.
What should I use View or Stored Procedure which help me to reduce SQL Overhead?