Subject | Re: [firebird-support] Query Help? |
---|---|
Author | Arno Brinkman |
Post date | 2004-10-31T23:13:46Z |
Hi,
Count(ITEMS.PRODUCTDESCRIPTION) AS CountItems,
Sum(ITEMS.ITEMPRICE) AS TotalItems,
ITEMS.ORDERID,
ITEMS.PRODUCTDESCRIPTION,
Min(ITEMS.ItemID)
FROM
ITEMS
GROUP BY
ITEMS.ORDERID,
ITEMS.PRODUCTDESCRIPTION,
HAVING
ITEMS.ORDERID = :OrdID
ORDER BY
5;
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://80.126.130.81
> This is the current statement that I use:a
>
> SELECT
> Count(ITEMS.PRODUCTDESCRIPTION) AS CountItems,
> Sum(ITEMS.ITEMPRICE) AS TotalItems,
> ITEMS.ORDERID, ITEMS.PRODUCTDESCRIPTION,
> FROM ITEMS
> GROUP BY
> ITEMS.ORDERID,
> ITEMS.PRODUCTDESCRIPTION,
> HAVING ITEMS.ORDERID = :OrdID;
>
> What I need to do is pull both pull the records out as they were entered
> into the database, but also group them by productdescription which forces
> sort on the productdescription. I can't use ItemID to ORDER BY (which isit
> the record id for a particular orderID) because I am forced to use to use
> in the GROUP BY and since the value is unique per record....SELECT
>
> Any suggestions on a work around I might try?
Count(ITEMS.PRODUCTDESCRIPTION) AS CountItems,
Sum(ITEMS.ITEMPRICE) AS TotalItems,
ITEMS.ORDERID,
ITEMS.PRODUCTDESCRIPTION,
Min(ITEMS.ItemID)
FROM
ITEMS
GROUP BY
ITEMS.ORDERID,
ITEMS.PRODUCTDESCRIPTION,
HAVING
ITEMS.ORDERID = :OrdID
ORDER BY
5;
Regards,
Arno Brinkman
ABVisie
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Firebird open source database (based on IB-OE) with many SQL-99 features :
http://www.firebirdsql.org
http://www.firebirdsql.info
http://www.fingerbird.de/
http://www.comunidade-firebird.org/
Support list for Interbase and Firebird users :
firebird-support@yahoogroups.com
Nederlandse firebird nieuwsgroep :
news://80.126.130.81