SELECT * FROM ORders
WHERE OrderNumber IN (SELECT Min(OrderNumber) from Orders WHERE customerid =
1234)
ORDER BY OrderNumber, ItemID

??  Making it up....

----- Original Message -----
From: "Giles Roadnight" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, November 04, 2002 4:09 PM
Subject: [ cf-dev ] Maxrows and grouping


> Hi guys.
>
> I have this code:
>
> <cfoutput query="getInvoicesReturn" group="ordernumber">
> <h2>#ordernumber#</h2>
> <cfoutput>
> #booknumber#
> </cfoutput>
> </cfoutput>
>
> That gives me this output:
>
> 5182
> 1 2 3 4 5 17 18 6 7 8 9 10 11 12
> 5183
> 1 2 3 4 5 17 18 6 7 8 9 10 11 12
>
> This is all well and good but I want to output only the first order so
> this code:
>
> <cfoutput query="getInvoicesReturn" group="ordernumber" maxrows="1">
> <h2>#ordernumber#</h2>
> <cfoutput>
> #booknumber#
> </cfoutput>
> </cfoutput>
>
> gives me this output:
>
> 5182
> 1
>
> How can I get it to only give me the first order? I am sure I have got
> this to work before but I can't remember how. I could do it with IF's of
> course - only outputting the line if the order number is the same as the
> last one but I would rather do it another way if possible.
>
>
> Giles Roadnight
> http://giles.roadnight.name
>
>
>
> --
> ** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
>
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> For human help, e-mail: [EMAIL PROTECTED]
>
>



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to