Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
wentihenduo
Starting Member
8 Posts |
Posted - 2013-02-27 : 03:50:23
|
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 ago2 a post 2min ago3 someone joined some group 3min ago4 a post 4min ago5 a post 5min ago6 someone changed some info 10min ago7 a post 11min ago8 ...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! |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-02-27 : 04:03:03
|
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 MVPhttp://visakhm.blogspot.com/ |
|
|
|
|
|
|
|