Page 1 of 1

[Solved - Operator Error]Is my SQL statement correct?

Posted: Wed Nov 15, 2006 1:46 am
by ridshack
Is my SQL statement correct?

When I run this query with any two conditions it works fine but add the third and nothing.

Code: Select all

$rtquery  = "SELECT * FROM Tickets WHERE Queue='$rtclient' AND LastUpdatedBy='$rttech' AND LastUpdated like '$rtdate'";
Thank you for any guidance.

Posted: Wed Nov 15, 2006 2:15 am
by timvw
What is the type of the LastUpdated column? Most probably it's a DATE(TIME) type and thus you probably want to use the = operator instead of the LIKE operator....

Posted: Wed Nov 15, 2006 2:18 am
by Chris Corbyn
timvw wrote:Most probably it's a DATE(TIME) type and thus you probably want to use the = operator instead of the LIKE operator....
Perhaps if it is DATE or DATETIME then you may have been using LIKE to approximate a date. Use the BETWEEN operator to give a date range ;)

Posted: Wed Nov 15, 2006 9:58 am
by ridshack
It was all me… I was querying other tables to get my variables for this SQL statement and the results where almost correct. This is what happens when a project become more complicated then I am capable of handling late at night. Since Im still in learning mode I thank your responses and will consider how they will affect my query.

Thanks again,
Rid