[ 
https://issues.apache.org/jira/browse/DERBY-7051?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16906776#comment-16906776
 ] 

JackLi0812 commented on DERBY-7051:
-----------------------------------

Hi, Rick:

      Let's say I have a table with a purchase history that contains the users 
column and the items column, and I want to know the total number of users and 
the total number of items that I bought, so I need 
{code:java}
SELECT count(DISTINCT user) as userCount, count(DISTINCT product) as 
productCount
FROM tableName;{code}
Such a query.

> Multiple DISTINCT columns are not supported
> -------------------------------------------
>
>                 Key: DERBY-7051
>                 URL: https://issues.apache.org/jira/browse/DERBY-7051
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>         Environment: derby-10.11.1.1;
>            Reporter: JackLi0812
>            Priority: Major
>
>  
> {code:java}
> SELECT DISTINCT (ORDERS.CUSTOMER_ID), DISTINCT (ORDERS.ORDER_ID)
> FROM ORDERS
> ORDER BY ORDERS.ORDER_ID
> ;{code}
> throw error: 
> {code:java}
> SQL Error [42X01]: Syntax error: Encountered "DISTINCT" at line 1, column 39.
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to