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

[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
spx for moving values to new table 5 70
Change variables in SQL table 6 82
sql help 5 52
How can i get data when i use where clause with group by? 3 22
If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
Data architecture is an important aspect in Software as a Service (SaaS) delivery model. This article is a study on the database of a single-tenant application that could be extended to support multiple tenants. The application is web-based develope…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: (…

867 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now