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

Home -> Community -> Usenet -> c.d.o.tools -> Re: SELECT statement

Re: SELECT statement

From: Clint Johns <cmjohns_at_ucdavis.edu>
Date: Wed, 2 May 2001 11:08:26 -0700
Message-ID: <9cpidv$s81$1@woodrow.ucdavis.edu>

try:

desc emp_status

see if the attribute 'status' has the constraint 'is not null' if so, then I should have asked beforehand, because adding 'or status = NULL' would not yield anymore information from your query...

...perhaps try using "or status = ' '"

-Clint

"Mac Flores IV" <macflores_at_northwestern.edu> wrote in message news:slrn9f0hjc.s76.macflores_at_suzuki.wmitc.nwu.edu...
> There are no NULL or empty string values in the Status column. I
> tried this and it still does not produce the TABLE VIEW I require.
> Any other thoughts?
> --------------
> On Wed, 2 May 2001 09:25:07 -0700, Clint Johns <cmjohns_at_ucdavis.edu>
 wrote:
> >try WHERE status = 'Y' or status = NULL
> >
> >if NULL doesn't work, try the empty character string ''
> >
> >hope this helps,
> >
> >Clint
> >
> >
> >"Mac Flores IV" <macflores_at_northwestern.edu> wrote in message
> >news:slrn9f0bk4.s0k.macflores_at_suzuki.wmitc.nwu.edu...
> >>
> >> GIVEN the following table:
> >>
> >> TABLE Emp_status
> >> Emp Status
> >> ----------
> >> A Y
> >> A Y
> >> B Y
> >> B N
> >> C N
> >> C N
> >> D Y
> >> D N
> >> E Y
> >> E Y
> >> F N
> >> F N
> >>
> >> I would like a SELECT statement which will count how many 'Y' each
> >> employee has. If there is no 'Y' then the employee gets a count of
> >> '0' as shown in the table VIEW below:
> >>
> >> TABLE VIEW Emp_grade_vu
> >> Emp Grade
> >> ---------
> >> A 2
> >> B 1
> >> C 0
> >> D 1
> >> E 2
> >> F 0
> >>
> >> I can do:
> >> CREATE VIEW AS Emp_grade_vu AS
> >> SELECT Emp, count(*) Status FROM Emp_status
> >> WHERE Status = 'Y'
> >> ORDER BY Emp;
> >>
> >> but this will obviously extract only those Emps with 'Y' status. How
> >> can I include the Emps with '0' Y values? Does this require a JOIN or
> >> do I have to structure some kind of DECODE function in the SELECT
> >> statement?
> >>
> >> Any help is greatly appreciated.
> >>
> >>
> >
> >
Received on Wed May 02 2001 - 13:08:26 CDT

Original text of this message

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