Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Return 1 row from joined table
Mike Dole wrote:
> I'm having a problem with this SQL string, I want 1 record from each
> joined salestrans table like for instance:
>
> SALESNUMBE ITEMNUMBER
> ---------- --------------------
> 738744 6398000
> 738734 1201270
> 738737 2216000
> 738644 5251000
> 738694 5943000
> 737714 2401000
> 736774 5943000
>
> But the following SQL string:
>
> SELECT str.salesnumber, str.itemnumber FROM XAL_SUPERVISOR.SALESTRANS
> STR, XAL_SUPERVISOR.SALESTABLE ST WHERE str.dataset = 'FIK' AND
> st.dataset = 'FIK' AND st.salesnumber = str.salesnumber AND
> st.DELIVERYDATE = TO_DATE('23-12-2004', 'DD/MM/YYYY') AND st.FIKRetbon
> = 1 AND ROWNUM = 1
>
> Returns only:
>
> SALESNUMBE ITEMNUMBER
> ---------- --------------------
> 738744 6398000
>
> Can someone please tell me how I solve this?
>
> Thanks in advance,
>
> Mike
AND ROWNUM = 1 guarantees the return of one and only one row no matter the query.
-- Daniel A. Morgan University of Washington damorgan_at_x.washington.edu (replace 'x' with 'u' to respond) -----------== Posted via Newsfeed.Com - Uncensored Usenet News ==---------- http://www.newsfeed.com The #1 Newsgroup Service in the World! -----= Over 100,000 Newsgroups - Unlimited Fast Downloads - 19 Servers =-----Received on Thu Dec 23 2004 - 07:26:42 CST