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 > Data Access, Manipulation & Batch Languages > Delphi, C etc > Problems outputing field from query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-23-04, 08:46
m.inckle m.inckle is offline
Registered User
 
Join Date: Feb 2004
Posts: 24
Problems outputing field from query

Hi im using SQL2000 as a backend DB

When running this query the Month field is not being outputted

SELECT (MONTH(msg.ts)) AS 'MonthSort',
(DATENAME(mm,msg.ts) + ' ' + DATENAME(yy,msg.ts)) AS 'Month',
COUNT(msg.ts) as 'Count'
FROM msg
WHERE msg.op_id = 1
GROUP BY (DATENAME(mm,msg.ts) + ' ' + DATENAME(yy,msg.ts)),
(MONTH(msg.ts))
ORDER BY 'MonthSort' ASC


has anyone got any ideas?????
Reply With Quote
  #2 (permalink)  
Old 02-23-04, 10:12
rami.haddad rami.haddad is offline
Registered User
 
Join Date: Jan 2004
Posts: 184
Re: Problems outputing field from query

Please give a sample value of msg.ts to be able to answer.
__________________
In abundance of water only the fool is thirsty. Bob Marley.
Reply With Quote
  #3 (permalink)  
Old 02-23-04, 10:24
m.inckle m.inckle is offline
Registered User
 
Join Date: Feb 2004
Posts: 24
Re: Problems outputing field from query

example of msg.ts would be

'23/02/2004 15:25:12' as a datetime field in SQL2000
Reply With Quote
  #4 (permalink)  
Old 02-23-04, 17:02
rami.haddad rami.haddad is offline
Registered User
 
Join Date: Jan 2004
Posts: 184
Re: Problems outputing field from query

The problem is that SQL is looking for a datetime in the MM/DD/YYYY format however you are sending a DD/MM/YYYY format. Once you make the change your query should work.

http://www.geocities.com/scirocco_ha/DataControl.htm
__________________
In abundance of water only the fool is thirsty. Bob Marley.
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