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 2005 Forums
 Transact-SQL (2005)
 Combine Queries

Author  Topic 

Mondeo
Constraint Violating Yak Guru

287 Posts

Posted - 2008-09-12 : 10:53:15
Hi,

Got these

SELECT TECH_Value_String FROM NVDTechnical WHERE TECH_TechCode = 1 AND TECH_Id = 26939 AND TECH_EffectiveTo IS NULL)

(SELECT TECH_Value_String FROM NVDTechnical WHERE TECH_TechCode = 2 AND TECH_Id = 26939 AND TECH_EffectiveTo IS NULL)

How can I combine them so that I get one row with two columns returned?

Thanks

Vinnie881
Master Smack Fu Yak Hacker

1231 Posts

Posted - 2008-09-12 : 11:23:21
[code]
select (SELECT top 1 TECH_Value_String FROM NVDTechnical WHERE TECH_TechCode = 1 AND TECH_Id = 26939 AND TECH_EffectiveTo IS NULL), as column1
(SELECT top 1 TECH_Value_String FROM NVDTechnical WHERE TECH_TechCode = 2 AND TECH_Id = 26939 AND TECH_EffectiveTo IS NULL) as column2
[/code]


Success is 10% Intelligence, 70% Determination, and 22% Stupidity.
\_/ _/ _/\_/ _/\_/ _/ _/- 881
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-13 : 13:39:22
Will the subqueries be returning single value?
Go to Top of Page
   

- Advertisement -