Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

join problem

Status
Not open for further replies.

ratjetoes

Programmer
May 24, 2002
30
NL
hi,

i built a join clause like this:

select *
from (select p.ZID from tbl_P p where p.EID=4) ps
inner join (select *
from (select t.ID from tbl_T t where t.TCode='EN') ts
inner join tbl_PT pt on ts.ID = pt.ID) pj
on ps.ZID=pj.ZID

is says field ID is double in pj, how should i rewrite this sqlstatement?

t.i.a.,
ratjetoes.
 
which table does pj.ZID come from?
I'm guessing tbl_T
something like

select ps.ZID, ts.ID,
from tbl_P ps
inner join tbl_T ts
on ps.ZID=ts.ZID
inner join tbl_PT pt
on ts.ID = pt.ID
where ts.TCode='EN'
and ps.EID = 4


======================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top