Page 1 of 1

where question regarding dates : [SOLVED]

Posted: Mon Jan 12, 2004 11:02 am
by waskelton4
This should be simple.. hope someone can help

in my sql..

Code: Select all

SELECT Date_Format(tsTimeStamp, '%m-%d-%Y: %r') as dtCreated
FROM table WHERE dtCreated LIKE '2004-01-01%' ORDER BY dtCreated
is the where applied to tsTimeStamp or the post-formated dtCreated?


TIA!
Will

Posted: Mon Jan 12, 2004 1:02 pm
by scorphus
[wrong]
It is applied to the post-formated dtCreated
[/wrong]

[edit]
This query will rise an error of this type:

Code: Select all

Unknown column 'dtCreated' in 'where clause'
[/edit]

Posted: Mon Jan 12, 2004 1:04 pm
by waskelton4
Thank you much!

Posted: Mon Jan 12, 2004 1:26 pm
by scorphus
OMG! :oops: I'm sorry, forum mate. I'm completely wrong! I read your post a bit fast and understood that you were asking about the ORDER BY clause.

When you try this query you will get an error from MySQL saying that there is no dtCreated filed on the table.

Please excuse my lack of attention.

Regards,
Scorphus.

Posted: Mon Jan 12, 2004 1:34 pm
by waskelton4
A HA! that's why i've been getting those wierd results..

Both of my tables do have a dtCreated field.. so i get no error.. but i get bogus data..

Thanks for the re-reply :)

Now i know what i must do..

peace
will

Posted: Mon Jan 12, 2004 1:39 pm
by scorphus
Well, it's nice you fixed things and know what to do. Sorry for making you spend your time :oops:

Regards,
Scorphus.