If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > newb select query - syntax help!!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-03-07, 05:42
lizzarrd lizzarrd is offline
Registered User
 
Join Date: Dec 2007
Location: London
Posts: 6
newb select query - syntax help!!

Can anyone tell me what is wrong with the seemingly simple statement below??

==============================
Select
DATE(trasnac_date) as Date
, COUNT(*)
From
tb_transaction
Where
company_sn=101
Group by
DATE(transac_date)
=============================


I get a generic Syntax error message...
Reply With Quote
  #2 (permalink)  
Old 12-03-07, 06:33
ceinma ceinma is offline
Registered User
 
Join Date: Apr 2007
Location: Jundiai / SP - Brasil
Posts: 311
DATE(trasnac_date) != DATE(transac_date)
__________________
________________________________________
César Inacio Martins
Jundiai / SP - Brasil
http://www.imartins.com.br/informix - em Português
http://www.imartins.com.br/informix - English (translated by Google).
________________________________________
Reply With Quote
  #3 (permalink)  
Old 12-03-07, 07:10
lizzarrd lizzarrd is offline
Registered User
 
Join Date: Dec 2007
Location: London
Posts: 6
Thanks for the reply.

Although that would have been an easy fix. The syntax error remains (for the following code):

=========================
Select
DATE(transac_date) as Date
, COUNT(*)
From
tb_transaction
Where
company_sn=101
Group by
DATE(transac_date)
=========================

It seems that the error lies in the Group by clause and using functions within it. The following executes without any problems:

=========================
Select
transac_date as Date
, COUNT(*)
From
tb_transaction
Where
company_sn=101
Group by
transac_date
=========================

Thanks in advance,

L
Reply With Quote
  #4 (permalink)  
Old 12-05-07, 04:45
nog nog is offline
Registered User
 
Join Date: Nov 2004
Posts: 26
try GROUP BY 1
Reply With Quote
  #5 (permalink)  
Old 12-05-07, 05:00
lizzarrd lizzarrd is offline
Registered User
 
Join Date: Dec 2007
Location: London
Posts: 6
Thanks! so simple....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On