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.
    
        | 
                
                    | 
                            
                                | Author | Topic |  
                                    | r000tStarting 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, DurationFROM            tblTopicsWHERE        (TopicCode IN (@TopicCode1, @TopicCode2)) [/CODE][CODE]SELECT        DateStarted, DateToEndFROM            tblSubscriptionsWHERE        (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? |  |  
                                    | webfredMaster Smack Fu Yak Hacker
 
 
                                    8781 Posts | 
                                        
                                          |  Posted - 2010-04-15 : 05:46:59 
 |  
                                          | selectt.TopicName,t.Duration,s.DateStarted,s.DateToEndfrom tblTopics as tjoin tblSubscriptions as son s.TopicCode=t.TopicCodewhere 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.
 |  
                                          |  |  |  
                                |  |  |  |