|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Help w/query ...
I created a table (help) that I am using to store msgs for a msg board. I would like to query the table to produce a result set that returns a list by most recently posted but also only one result per unique msg_num. This is what the table looks like:
Quote:
I tried: "select distinct msg_num from help order by date desc" but that doesnt give me msg_num 1 sub_num 1 it uses msg_num 1 sub_num 0. When a user views the board I want the most recently modified topics to be at the top of the list, much like the way this board shows posts. This way if there is a reply to an old post the query would bring it all the way to the top of the list. Any help would be greatly appreciated. |
|
#3
|
|||
|
|||
|
RE: Help w/query ...
Give this a try:
SELECT msg_num, MAX(date) from help GROUP BY msg_num Let me know how it goes... |
|
#4
|
|||
|
|||
|
RE: Help w/query ...
MAX, how did I forget about MAX? :rolleyes: That looks really promising I am going to try it now.
Thanks |
|
#5
|
|||
|
|||
|
RE: Help w/query ...
Beutiful! I knew there was a reason why I hung out around here
With a little tweakin' I got it to work. Here is the final query for completeness: select topic, msg_num, max(date) as msg_seq from help group by msg_num order by msg_seq desc Thank you very much |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Help w/query ... |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|
|