Link to home
Start Free TrialLog in
Avatar of noulouk
noulouk

asked on

Merge SELECT

Hi Experts,

SELECT Name From TableName WHERE id=1

SELECT FirstName From TableFirstName  WHERE id=1

I want a result in 1 resultset like this:
Name | FirstName

Thanks in advance for your help.
Avatar of Aneesh
Aneesh
Flag of Canada image

one way is

SELECT (SELECT Name From TableName WHERE id=1) Name ,
 (SELECT FirstName From TableFirstName  WHERE id=1) FirstName

Otherway is join the two tables, for which we need information on how these two tables are related


Avatar of noulouk
noulouk

ASKER

OK, but I have several columns to select in my tables like this:
SELECT Name, Name2, Name3 From TableName WHERE id=1

SELECT FirstName,FirstName2,... From TableFirstName  WHERE id=1

Sorry.
ASKER CERTIFIED SOLUTION
Avatar of Aneesh
Aneesh
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of noulouk

ASKER

I 'm agree dqmq.
I will  ask a new question.