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
 Other Forums
 MS Access
 Can't do this

Author  Topic 

r000t
Starting Member

3 Posts

Posted - 2010-04-15 : 05:31:23
Hello,

Im new to queries and i'm trying to pull off a seemingly tricky one.

Somehow I need to 'merge' or 'combine' the two queries below into one:

[CODE]SELECT TopicName, Duration
FROM tblTopics
WHERE (TopicCode IN (@TopicCode1, @TopicCode2)) [/CODE]

[CODE]SELECT DateStarted, DateToEnd
FROM tblSubscriptions
WHERE (UserID = @UserID) AND (TopicCode IN (@TopicCode1, @TopicCode2))[/CODE]

At first glance I thought this was impossible to do but it's worth a try posting on a forum where people know alot more than me on the subject :)

Any ideas?

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-04-15 : 05:46:59
select
t.TopicName,
t.Duration,
s.DateStarted,
s.DateToEnd
from tblTopics as t
join tblSubscriptions as s
on s.TopicCode=t.TopicCode
where t.TopicCode in (@TopicCode1, @TopicCode2)
and s.UserID = @UserID


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -