morpheusdreams
morpheusdreams

Reputation: 55

Using MySQL query does not return data if only date used in where clause but does return data if I include other parameters

I don't have access to the actual code at the moment to show you but I am having an issue running a query which returns no results if I use a where clause with the only parameter being a date. However if I also include another parameter like an ID then it returns results.

As an example this would return no results:

SELECT *
FROM table
WHERE date >= '2013-01-01'

Whereas this would return results:

SELECT *
FROM table
WHERE date >= '2013-01-01' and ID = 2

I've had other people looking over it to confirm it makes no sense. Similar queries work fine. If no one has an idea I will update with the actual queries tomorrow.

Thank you in advance for your help.

Upvotes: 0

Views: 118

Answers (1)

Riho
Riho

Reputation: 4595

It's a shot in the dark, but as "date" is also field type - maybe there is some kind of conflict when only field with this name is used in WHERE.

Upvotes: 1

Related Questions