Posted on 2007-04-03
Last Modified: 2012-06-21
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.
Question by:noulouk
  • 2
  • 2
LVL 75

Expert Comment

by:Aneesh Retnakaran
ID: 18844576
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


Author Comment

ID: 18844647
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

LVL 75

Accepted Solution

Aneesh Retnakaran earned 480 total points
ID: 18844665
Select f.Name, f.Name1, f.name2, f.Name3
          S.FirstName, s.FirstName2
FROM TableName f
INNER JOIN TableFirstName S
ON f.ID = S.ID
WHERE s.ID  = 1
LVL 42

Assisted Solution

dqmq earned 20 total points
ID: 18845320
It would be helpful if you show the table structures along with the desired output.  That way we don't have to guess.

Author Comment

ID: 18846217
I 'm agree dqmq.
I will  ask a new question.

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
SQL Trigger selecting another database 4 37
How to import SQL 2000 database to SQL 2014 5 110
Bubble user-defined Sql RAISERROR(...) to c# exception 14 167
Grid querry results 41 78
Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question