Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: sql query help
steve wrote:
> steve wrote...
> > DA Morgan wrote...
> >> steve wrote:
> >>
> >>> hi peeps
> >>>
> >>> i have a table set up
> >>>
> >>> table: orderitems
> >>> orderid
> >>> productid
> >>> qty
> >>>
> >>> is there anyway of listing productid of items ordered x times?
> >>>
> >>> i have managed to get basic things working but found no reference to
> this
> >>> and not sure if the set up of my database would allow such a query
> >>>
> >>> cheers :)
> >>>
> >>> --
> >>> get me tools and beer
> >>
> >> There is indeed.
> >>
> >> SELECT productid, COUNT(*)
> >> FROM orderitems
> >> GROUP BY productid
> >> HAVING COUNT(*) = x;
> >>
> >> Go to http://tahiti.oracle.com and search on GROUP BY.
> >>
> >> Daniel Morgan
> >
> > Thanks very much.
> >
> > I didnt know it was possible, done a search on google gave me loads of
> other
> > stuff and I didnt have any idea how to word the search. Never occured to
> me
> > to check the oracle site!
> >
> > Thanks again :)
>
>
>
>> o3,p2,q1
> o1,p2,q1
> o1,p5,q1
> o2,p3,q1
>
>
Is this school work? If so we don't do homework unless we get the certificate. If this is work for an employer why aren't you asking a senior developer or your DBA?
Daniel Morgan Received on Wed Mar 05 2003 - 11:01:20 CST