Welcome Guest, Not a member yet? Register   Sign In
Query not following rules!!
#17

[eluser]TWP Marketing[/eluser]
[quote author="codemonkey" date="1347288270"]The empty strings are from me not putting in a search term, which returns everything, which works as intended.

With a search term:

Code:
SELECT *
FROM (`item_history`)
WHERE `added_by` =  'tech1'
AND  `ticket_num`  LIKE '%tom%'
OR  `serial_num`  LIKE '%tom%'
OR  `part_num`  LIKE '%tom%'
OR  `make`  LIKE '%tom%'
OR  `model`  LIKE '%tom%'
OR  `user_first_name`  LIKE '%tom%'
OR  `user_last_name`  LIKE '%tom%'
OR  `reason`  LIKE '%tom%'
OR  `date_created`  LIKE '%tom%'
ORDER BY `date_created` DESC
LIMIT 100

For the second part, your example is actually how I had the code layed out before putting it all into a array, I'm telling you, I tried everything before posting.

I changed it back to match your example and it still did not work. I removed the other OR_LIKEs and left just one of them and it tested working.

So, does that mean OR_LIKE and WHERE don't play nice together?[/quote]

So you left the first LIKE and the first OR_LIKE and it works? or just the first LIKE works?
If one OR_LIKE works, then logically, they all should, except they don't... Hmmm!

RE using HAVING instead of WHERE. If it works, go with it, although it would be nice to know why WHERE doesn't work here...


Messages In This Thread
Query not following rules!! - by El Forum - 09-07-2012, 01:27 PM
Query not following rules!! - by El Forum - 09-07-2012, 01:30 PM
Query not following rules!! - by El Forum - 09-07-2012, 01:33 PM
Query not following rules!! - by El Forum - 09-07-2012, 01:45 PM
Query not following rules!! - by El Forum - 09-07-2012, 01:49 PM
Query not following rules!! - by El Forum - 09-07-2012, 02:04 PM
Query not following rules!! - by El Forum - 09-07-2012, 02:10 PM
Query not following rules!! - by El Forum - 09-07-2012, 02:23 PM
Query not following rules!! - by El Forum - 09-07-2012, 02:29 PM
Query not following rules!! - by El Forum - 09-07-2012, 05:00 PM
Query not following rules!! - by El Forum - 09-10-2012, 06:27 AM
Query not following rules!! - by El Forum - 09-10-2012, 07:17 AM
Query not following rules!! - by El Forum - 09-10-2012, 07:44 AM
Query not following rules!! - by El Forum - 09-10-2012, 08:07 AM
Query not following rules!! - by El Forum - 09-10-2012, 08:15 AM
Query not following rules!! - by El Forum - 09-10-2012, 08:38 AM
Query not following rules!! - by El Forum - 09-10-2012, 08:51 AM
Query not following rules!! - by El Forum - 09-10-2012, 09:14 AM
Query not following rules!! - by El Forum - 09-10-2012, 09:36 AM
Query not following rules!! - by El Forum - 09-10-2012, 11:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB