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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Forum problem

Author  Topic 

fantasimus
Starting Member

4 Posts

Posted - 2005-10-25 : 11:59:43
Hi,

i want to query the database for this forum function:
show me all topics in which i anwsered with my highest postid
example: my post number is 13 and the total posts are 30.. so it should look like this, that the postid is 13 ..my postid should be shown



tables:

topic
topicid INT

REPLYS
ID INT
TOPICID INT
POSTID smallint // a sequ. number for the topic (1,2,3,4,5....)
USERID INT



SELECT distinct(topicid),postid
FROM topic T INNER JOIN
replys R ON T.topicid = R.topicid
WHERE (R.userid = 10)
ORDER BY T.topicid DESC

this sql statement is wrong. it shows me all topicids with the postid

:-(((

hope you got me

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-10-26 : 01:18:03
Post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -