all groups > sql server misc > october 2003 >
You're in the

sql server misc

group:

SQL query problem


SQL query problem kiran NO[at]SPAM boardroomlimited.com
10/5/2003 6:38:15 PM
sql server misc: Hi, I hv the following query that is returning correct values.
However, I want to add one more condition to this query.

select b.btdnumber as btdnumber,
b.btdtrfno as bbtdtrfno,
a.btdtrfno as btdtrfnohidden,
a.BtdAcno as BtdAcno,
a.BtdCertNo as BtdCertNo,
a.BtdShare as BtdShare
from shrbatchdetail a
right outer join shrbatchdetail b
on a.btdrecid = b.btdrecid
and a.btdsellbuy = 'S'

Along with the above details and satisfying above conditions, I want
to get

c.shmName from shrShareMaster c where c.shmacno = b.btdacno

Pls help me to modify the query.

Re: SQL query problem John Bell
10/11/2003 2:43:28 PM
Hi

It is alot easier if you post the DDL (Create table statements) Example data
(as insert statements) as well as your query
and expected results.

As you already have a join then I am not sure why you have problems joining
the extra table. What errors are you getting.?

A guess would be:
SELECT b.btdnumber as btdnumber,
b.btdtrfno as bbtdtrfno,
a.btdtrfno as btdtrfnohidden,
a.BtdAcno as BtdAcno,
a.BtdCertNo as BtdCertNo,
a.BtdShare as BtdShare,
c.shmName as shmName
FROM shrbatchdetail a
RIGHT OUTER join shrbatchdetail b on a.btdrecid = b.btdrecid and
a.btdsellbuy = 'S'
JOIN shrShareMaster c ON c.shmacno = b.btdacno


John
[quoted text, click to view]

AddThis Social Bookmark Button