Brett Randall wrote:

I have two questions about the use of sql:query:

1) Can sql:query handle aliases of the form "select column1 as alias1 from table1".

2) Can sql:query handle aggregates of the form "select column1, count(*) from table1 group by column1". With reference to 1) above, does count(*) need to be aliased?

Yes to all; here's an example I'm using right now -- works fine :-)


<sql:query var="quantities">
SELECT
        count(product) as thisQuantity
FROM
        inventoryByProduct
WHERE
        product = ?
GROUP BY
        product
<sql:param value="${product}"/>
</sql:query>

<c:set var="inventoryCount" value="${quantities.rows[0].thisQuantity}"/>


HTH! -- Hassan Schroeder ----------------------------- [EMAIL PROTECTED] Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com

dream. code.



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



Reply via email to