SQL SELECT * FROM
emp;
NAME
EMP BOSS-- --
--SAMAR
10
20ASHOK
20
30ASHWINI
30
40MONIKA
11
21RASHI
21
31SMRITI
12
22SUMEET
22 32
7 rows selected.
SQL SELECT *
2 FROM emp 3
WHERE emp NOT IN ( SELECT emp
4
FROM emp
5
START WITH emp = 10 CONNECT BY
Hey list Guru, Can anyone help me with this query?Many thanks,
SELECT
A.COUNTY_CODE,
C.COUNTY_NAME,
lpad(B.PRECINCT,4,' '),
count(*),
sum(DECODE(0,floor((months_between(sysdate,
A.DOB)-(18*12))/(1*12)),1,0)),
sum(DECODE(0,floor((months_between(sysdate,
If I understand it right you need a count for every day in interval records.
I think, that the easiest way how to get right numbers (it's not much
sophisticated, but ...) is:
1. create table day_count( day_id number, day_nbr number );
2. fill table day_count with tuples where day_id starts at
Seema,
The following would work (there will be better ways to do it especially if
you're on Oracle 8) but I'm stuck with 7.3. You'll need to have access to a
table which will always have at least have 15 rows (I've used all_objects
here).
SELECT day, COUNT(*)
FROM table_name,
(SELECT
Title: QUERY HELP
One
way to do this is in the procedure, use variables that hold the previous values
(e.g. last_rnum := rnum). Then, do your comparison of your current value to your
last stored value (e.g. if rnum - last_rnum 1 then flag='*'). I am sure
there are more than one way to skin
Title: RE: QUERY HELP
Have you tried this:
select tab2.col1, tab2.col2, x.col1, x.col2
from
(select column1 col1,
column2 col2
from tab2
where ( your independent conditions here, can't refer to outer query here)
) x,
tab2
where x.col1 = tab2.col1 [etc...]
Is that what you
Nirmal,
You said I need this in reports. If you mean Oracle Reports, there are a
few ways to do it. If not Oracle Reports, skip down to the SQL part.
1) Create a placeholder column outside query (or use a package variable,
whatever floats your boat).
2) Create a formula column within the group.
Title: QUERY HELP
Do you
want a query to return the missing numbers, or do you want a query to return the
records AFTER some numbers have been skipped ?
The
first can be done in pl/sql (loop with counter compared to rownum), the latter
in sql (use "where not exists ...").
HTH, Remco
--- Leslie Lu [EMAIL PROTECTED] wrote:
Just to clearfy my previous question (as follow):
if 1 has F and A and B, that what I want.
If 1 has F all the time, that's not what I want.
If 1 has A, B, C, but never F, that's not what I
want
either.
--- Leslie Lu [EMAIL PROTECTED] wrote:
try this..
SELECT DISTINCT AA FROM AA A WHERE STATUS='F' AND
AA IN (SELECT AA FROM AA B WHERE A.AA=B.AA AND STATUS 'F'
GROUP BY B.AA HAVING COUNT(B.AA) 1)
Ramana
--- Leslie Lu [EMAIL PROTECTED] wrote:
Just to clearfy my previous question (as follow):
if 1 has F and A and B, that what
Just to clearfy my previous question (as follow):
if 1 has F and A and B, that what I want.
If 1 has F all the time, that's not what I want.
If 1 has A, B, C, but never F, that's not what I want
either.
--- Leslie Lu [EMAIL PROTECTED] wrote:
Hi,
If I have this:
Customer_id Status
Hi Leslie,
This will be crude but it's a start. Gang, feel free to correct/improve:
select customer_id
from table_name
where
customer_id in (select customer_id from table_name where status = 'F')
and
customer_id in (select customer_id from table_name where status = 'A')
and
customer_id in
SELECT *
FROM customer c1
WHERE status = 'F'
AND EXISTS (SELECT 1
FROM customer c2
WHERE c2.customer_id = c1.customer_id
AND c2.status != 'F');
-Original Message-
Sent: Friday, June 22, 2001 2:06 PM
To: Multiple recipients of list ORACLE-L
Just to clearfy
Is 'F' the largest value? If so, then:
SELECT
customer_id
FROM
(
SELECT customer_id
, SUM(DECODE(status,'F',1,0)) stat_f
, SUM(DECODE(status,'F',0,1)) stat_no_f
FROM my_table
Here is one way:
select distinct customer_id c1 where exists
(select 'X' from customer_id where customer_id = c1.customer_id and status
= 'F')
and exists
(select 'X' from customer_id where customer_id = c1.customer_id and status
'F')
At 10:05 AM 6/22/01 -0800, you wrote:
Just to clearfy my
How about:
select f.customer_id
from table_name f, table_name a, table_name.b
where f.customer_id = a.customer_id and
f.customer_id = b.customer_id and
a.customer_id = b.customer_id and
f.status = 'F' and
a.status = 'A' and
b.status = 'B';
Much cleaner than the one
Is this what you are trying to do?
select a.customer_id
from table a, table b
where a.customer_id = b.customer_id
and a.status = 'F'
and b.status 'F'
Ron
[EMAIL PROTECTED]
[EMAIL PROTECTED]
Karaoke: Japanese for migraine
17 matches
Mail list logo