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 2000 Forums
 SQL Server Development (2000)
 Select statement

Author  Topic 

rajeshkumar77
Starting Member

46 Posts

Posted - 2002-02-17 : 06:30:29
Dear Friends,
In sql server, i have 2 tables called a and b.
how can i retrieve the data from those 2 tables with single query
for eg :

Table : a
columnname : eno

Table : b
columnname : ename.

how to retrive eno and ename from both the tables with single query.

I heard that the query will be like this.

select a.eno from a && b.ename from b;

but this is not working with me.

If anyone having idea, please tell me.

thanks in advance
Yours
Rajesh

nr
SQLTeam MVY

12543 Posts

Posted - 2002-02-17 : 06:33:37
How are the two tables connected?
If they aren't then something like

select eno, ename = convert(<datatype>,null) from a
union
select null, ename from b


==========================================
Cursors are useful if you don't know sql.
Beer is not cold and it isn't fizzy.
Go to Top of Page

azim
Starting Member

29 Posts

Posted - 2002-02-17 : 06:45:17
dear frind

ypu can do like this

select students.studentid,emp.empid from students,emp

azim
Go to Top of Page

rajeshkumar77
Starting Member

46 Posts

Posted - 2002-02-17 : 06:51:16
Dear Friends,
Thank you very much.
Your replies helped me alot.
Thanks again.
Yours
Rajesh

quote:

dear frind

ypu can do like this

select students.studentid,emp.empid from students,emp

azim



Go to Top of Page

Nazim
A custom title

1408 Posts

Posted - 2002-02-17 : 07:26:20
Rajesh ,

if your tables have any keys in common then this should help you.

select students.studentid,emp.empid from students
join emp
on empid.commonkey=students.commonkey





--------------------------------------------------------------
"Happiness is not something you experience, it's something you remember."
Go to Top of Page

Arnold Fribble
Yak-finder General

1961 Posts

Posted - 2002-02-17 : 08:01:13
What's a com-monkey? How does it related to cow-orkers?
(I also have difficulty with the shell item identifier type in the Windows API: SHITEMID)


Edited by - Arnold Fribble on 02/17/2002 08:08:27
Go to Top of Page
   

- Advertisement -