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)
 select statement

Author  Topic 

mike123
Master Smack Fu Yak Hacker

1462 Posts

Posted - 2003-06-26 : 05:45:32

I have 2 tables

tblUsers (userID, nameOnline)
tblInterests (userID, interestID)

I am trying to create a list of all users in TBLUSERS that have a certain interest. For example

I want to pass interestID = 1 to the stored procedure. I want to bring back all records in TBLUSERS that have their userID in the tblInterests with a corresponding INTERESTID of 1.

Any assistance greatly appreciated, this is a bit over my head.

Thanks alot guys.

Mike123

Page47
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2003-06-26 : 07:08:23
I'd recommend you look into buying a good book on SQL.

declare @interestID int
select
@interestID = 1

select
u.userid,
u.nameonline
from
dbo.tblUsers u
inner join dbo.tblInterests i
on u.userID = i.userID
where
i.interestID= @interestID

 


Jay White
{0}
Go to Top of Page

Amethystium
Aged Yak Warrior

701 Posts

Posted - 2003-06-26 : 09:53:05
You sound like a book yourself... and anyway... you've given him the answer so he doesn't need to buy a book!




Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2003-06-26 : 10:40:33
Yes, but Jay is just Page 47. What of all the other pages?

Sam

Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2003-06-26 : 11:54:56
Index is on Page 47



-------------------------
What lies behind you and what lies ahead of you are small matters compared to what lies within you.-Ralph Waldo Emerson


Edited by - nazim on 06/26/2003 11:55:35
Go to Top of Page
   

- Advertisement -