Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> SQL PROBLEM

SQL PROBLEM

From: Harvinder Singh <Harvinder.Singh_at_MetraTech.com>
Date: Thu, 24 May 2001 10:40:36 -0700
Message-ID: <F001.0030DBB7.20010524104630@fatcity.com>

<SPAN

class=500143917-24052001>Hi,
 
Favour
me in suggest a hint in writing a sql for following scenaio:
<SPAN

class=500143917-24052001> 
Table
A has 2 columns ord_id and line_id
<SPAN

class=500143917-24052001> 
<SPAN

class=500143917-24052001>example rows are:
<SPAN

class=500143917-24052001> 
<SPAN

class=500143917-24052001>ord_id         line_id
<SPAN

class=500143917-24052001>17                null
<SPAN

class=500143917-24052001>null              42
<SPAN

class=500143917-24052001> 
<SPAN

class=500143917-24052001>Table  B has columns ord_id and line_id
<SPAN

class=500143917-24052001> 
<SPAN

class=500143917-24052001>ord_id         line_id
<SPAN

class=500143917-24052001>17                42
<SPAN

class=500143917-24052001>17                43
<SPAN

class=500143917-24052001>17                44

<SPAN

class=500143917-24052001> 
I have
to write a sql to count(*) from table A where ord_id=17 .. as u
see from table B line 42 is row of ord_id=17 ..so i want
<SPAN

class=500143917-24052001>count(*) should show =2 from tabel A

but if
i do count(*) from table A where ord_id=17..it shows 1.. i need
to put another condition which will check line id with TABLE
B and if it is  for this particular order ...add that also in
<SPAN

class=500143917-24052001>count(*)............. I know
scenario is little fuzzy sorry for it..but if u got my point

kindly
respond.
<SPAN

class=500143917-24052001> 
<SPAN

class=500143917-24052001>Thanks
<SPAN

class=500143917-24052001>Harvinder Received on Thu May 24 2001 - 12:40:36 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US