Page 1 of 1
SELECT WHERE IN problem
Posted: Wed May 02, 2007 4:12 pm
by winky3d
see below please
Posted: Wed May 02, 2007 5:25 pm
by jayshields
Can you post an example SQL query (no variables)? Also, use the [ syntax="sql"] [ /syntax] tags (without spaces after the opening brackets).
Posted: Wed May 02, 2007 6:16 pm
by winky3d
Sorry, don't know what you meant by using [ syntax="sql"] [ /syntax] tags
Weirdan|Like it's done below in this post
Thx Weirdan.
Using mySQL 4.1
This returns the correct count:
Code: Select all
SELECT COUNT(*) FROM "._MY_TABLE." WHERE ts BETWEEN '2007-01-01 00:00:00' AND '2008-01-01 00:00:00' AND pcode IN ('aew', 'sdd')
This ignores the IN clause and returns all rows between the dates:
Code: Select all
SELECT email, l_name, state FROM "._MY_TABLE." WHERE ts BETWEEN '2007-01-01 00:00:00' AND '2008-01-01 00:00:00' AND pcode IN ('aew', 'sdd')
Suggestions?
solved
Posted: Wed May 02, 2007 8:44 pm
by winky3d
The code works fine. I don't...
The sql was preceded with an if(...) that had a null variable.
Sorry for wasting your time... and mine, argh!