Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
MYSQL modify output data
Old 09-26-2006, 03:41 PM MYSQL modify output data
SlayersOtaku's Avatar
Skilled Talker

Posts: 77
Name: Joe
Location: Oklahoma, USA
Trades: 0
I have no idea what this is called.

I need to GROUP by dates. However they are inputed by date and time in the same field. I need a way to cut off the last 6 digits before comparing the dates. Is there a way of doing this in MYSQL?
__________________

SlayersOtaku is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 09-27-2006, 04:30 AM Re: MYSQL modify output data
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
GROUP BY DATE(datetimefield)
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 09-27-2006, 11:07 AM Re: MYSQL modify output data
SlayersOtaku's Avatar
Skilled Talker

Posts: 77
Name: Joe
Location: Oklahoma, USA
Trades: 0
Maybe I didn't explain clear enough. All my date fields are different.

ex. 20031213091555, 20031213094904

Same day, different times so regular GROUP will not work here. I need a way to cut off the last 6 digits then GROUP.
__________________

SlayersOtaku is offline
Reply With Quote
View Public Profile
 
Old 09-28-2006, 02:23 AM Re: MYSQL modify output data
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
in that case;

GROUP BY left(datetimefield,length(datetimefield)-6)


<added>
A note for any future readers.

Be careful when choosing to store data in a field that is not ideal or you are doing some "independent thinking" on how numeric and date/time data is stored. Consider the "What ifs" for sorting, analysing and displaying the information in future times.

</added>
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?

Last edited by chrishirst; 09-28-2006 at 02:39 AM.. Reason: added something
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to MYSQL modify output data
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.13877 seconds with 12 queries