Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 question about table design
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

8 Posts

Posted - 02/27/2013 :  03:50:23  Show Profile  Reply with Quote
Hi! I am about to design a page, that request to display all users actions in time order, most likely action is posts, but there are some more, like someone joined a group, someone changed some info.
so, it should display on the page like the following:
1 a post 1min ago
2 a post 2min ago
3 someone joined some group 3min ago
4 a post 4min ago
5 a post 5min ago
6 someone changed some info 10min ago
7 a post 11min ago
8 ...

my question is, how can I do so?
because I can not put all these data in a single table, they are different types of data, but if I save them in different tables, then how can I select them, because I should put them together by time order. If I select them seperately, then how do I know which table I should take how many number of datum? for example, in 2 hours, there are only posts, and there are 2000 posts, if I just need 100 posts, then I should not select any other actions, but if some one just changed some info...

this is a very difficult problem for me, could some one give me some idea about this?

thanks in advance!

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 02/27/2013 :  04:03:03  Show Profile  Reply with Quote
you could put a view which selects data from all your tables and then use datefields in it to filter out your required data. the table data can be merged using union or union all so that if one or more tables doesnt have data within time it will still give you available data from others. also use TOP and ORDER BY if you want to select only subsets out of each table data

SQL Server MVP

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000