You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by DEBANJAN <De...@level3.com> on 2007/10/03 23:00:50 UTC

group by SQL query help

Hi,
I want to see the list of CIRCUIT_ID and EVENT_TYPE from ESB_CV_ORDER_EVENT
table.

Now when i execute this query-
select ESB_CV_ORDER_EVENT.CIRCUIT_ID, ESB_CV_ORDER_EVENT.EVENT_TYPE from
ESB_CV_ORDER_EVENT

I observe the correct output. 
Now when i try to group the output by ESB_CV_ORDER_EVENT.EVENT_TYPE and
execute the SQL query-
select ESB_CV_ORDER_EVENT.CIRCUIT_ID, ESB_CV_ORDER_EVENT.EVENT_TYPE from
ESB_CV_ORDER_EVENT group by ESB_CV_ORDER_EVENT.EVENT_TYPE

this gives me an error.

Can anyone help me out?
-- 
View this message in context: http://www.nabble.com/group-by-SQL-query-help-tf4564344s12049.html#a13027767
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: group by SQL query help

Posted by DEBANJAN <De...@level3.com>.
Hi bruce,
You are absolutely right. Rather making a group I should have used "order
by" thats too with a limit rownum <=50

Thanks a ton for the pointer.

-Dev

bsnyder wrote:
> 
> On 10/3/07, DEBANJAN <De...@level3.com> wrote:
>>
>> Hi,
>> I want to see the list of CIRCUIT_ID and EVENT_TYPE from
>> ESB_CV_ORDER_EVENT
>> table.
>>
>> Now when i execute this query-
>> select ESB_CV_ORDER_EVENT.CIRCUIT_ID, ESB_CV_ORDER_EVENT.EVENT_TYPE from
>> ESB_CV_ORDER_EVENT
>>
>> I observe the correct output.
>> Now when i try to group the output by ESB_CV_ORDER_EVENT.EVENT_TYPE and
>> execute the SQL query-
>> select ESB_CV_ORDER_EVENT.CIRCUIT_ID, ESB_CV_ORDER_EVENT.EVENT_TYPE from
>> ESB_CV_ORDER_EVENT group by ESB_CV_ORDER_EVENT.EVENT_TYPE
>>
>> this gives me an error.
>>
>> Can anyone help me out?
> 
> What database are you using? What error are you receiving? Please show
> the table schema.
> 
> I can take a guess if it's Oracle that you haven't  listed all
> non-aggregate columns being selected in the group by clause, but
> that's a complete guess.
> 
> Are you sure you want group by and not order by?
> 
> Bruce
> -- 
> perl -e 'print
> unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
> );'
> 
> Apache ActiveMQ - http://activemq.org/
> Apache ServiceMix - http://servicemix.org/
> Apache Geronimo - http://geronimo.apache.org/
> Castor - http://castor.org/
> 
> 

-- 
View this message in context: http://www.nabble.com/group-by-SQL-query-help-tf4564344s12049.html#a13040741
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: group by SQL query help

Posted by Bruce Snyder <br...@gmail.com>.
On 10/3/07, DEBANJAN <De...@level3.com> wrote:
>
> Hi,
> I want to see the list of CIRCUIT_ID and EVENT_TYPE from ESB_CV_ORDER_EVENT
> table.
>
> Now when i execute this query-
> select ESB_CV_ORDER_EVENT.CIRCUIT_ID, ESB_CV_ORDER_EVENT.EVENT_TYPE from
> ESB_CV_ORDER_EVENT
>
> I observe the correct output.
> Now when i try to group the output by ESB_CV_ORDER_EVENT.EVENT_TYPE and
> execute the SQL query-
> select ESB_CV_ORDER_EVENT.CIRCUIT_ID, ESB_CV_ORDER_EVENT.EVENT_TYPE from
> ESB_CV_ORDER_EVENT group by ESB_CV_ORDER_EVENT.EVENT_TYPE
>
> this gives me an error.
>
> Can anyone help me out?

What database are you using? What error are you receiving? Please show
the table schema.

I can take a guess if it's Oracle that you haven't  listed all
non-aggregate columns being selected in the group by clause, but
that's a complete guess.

Are you sure you want group by and not order by?

Bruce
-- 
perl -e 'print unpack("u30","D0G)U8V4\@4VYY9&5R\"F)R=6-E+G-N>61E<D\!G;6%I;\"YC;VT*"
);'

Apache ActiveMQ - http://activemq.org/
Apache ServiceMix - http://servicemix.org/
Apache Geronimo - http://geronimo.apache.org/
Castor - http://castor.org/