Make these 2 sql statements into one with the same functionality

Posted by Phil on Stack Overflow See other posts from Stack Overflow or by Phil
Published on 2010-04-19T12:36:20Z Indexed on 2010/04/19 12:43 UTC
Read the original article Hit count: 130

Filed under:
|

I have sql statement one;

select linkscat.id, linkscat.category 
from linkscat, contentlinks, links 
where contentlinks.linksid = links.id 
  and contentlinks.contentid = @contentid 
  and links.linkscatid = linkscat.id 
order by linkscat.category

and sql statement 2 takes a parameter called @linkscat which is 'id' from the statement above;

select * from links where linkscatid= @linkscat

I'm running into all types of trouble trying to use many sqldatareaders, nested repeaters etc, but it would be great if all the work could be done in the one statement? Is this possible and if so please can you help by posting the final statement?

Thanks greatly, any help much appreciated!

© Stack Overflow or respective owner

Related posts about sql

Related posts about mssql