mardi 29 avril 2014

How to fetch data for a news feed like system?


Vote count:

0




I have a few tables as shown below



Polls

PollId Question Option

1 What 1
2 Why 4

Updates

UpdateId Text

1 Sleep
2 Play


Polls and updates are just two sample tables (In reality there are more tables like ,photos, videos,links etc). But when a user visit his home (like facebook new feed) he must be displayed with data relevant to him (no such data included in this example). ie I want to select data from all tables with less number of query executions.


Currently, I'm fetching only ids and type (ie which table) from all of the tables and gather further data while iterating through this resultset. (ie from c# calling another SqlQuery) .


Is there a way to query the data from whole tables at once? (OUTER JOIN?, UNION?)



asked 2 mins ago






Aucun commentaire:

Enregistrer un commentaire