| SQL - can't see the error
|
Readie

msg:4135019 | 12:23 am on May 19, 2010 (gmt 0) | This is probably really simple, and I'm going to kick myself for not seeing it, but hey. I'm trying to execute the following the following query: SELECT FROM jobs WHERE active = "1" AND ( job_title LIKE "%one%" OR job_title LIKE "%two%" OR job_title LIKE "%three%" OR description LIKE "%one%" OR description LIKE "%two%" OR description LIKE "%three%" ) AND salary >= "15000" AND salary <= "20000" AND ( region_id = "28" OR region_id = "11" ) AND ( industry = "38" OR industry = "9" OR industry = "24" ) LIMIT 0 , 20 |
| And MySQL is throwing this error: | #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM jobs WHERE active = "1" AND (job_title LIKE "%one%" OR job_title LIKE "%two' at line 1 |
| As I said, I've been staring at this thing until my eyes bleed and I can't spot my error, so I was hoping someone here could chip in if they can see it?
|
Readie

msg:4135024 | 12:35 am on May 19, 2010 (gmt 0) | Gah, I should stop working when I'm nearly falling asleep. Damn next-day deadlines. SELECT [b]columns[/b] FROM jobs |
| Why is it always after you've publically humiliated yourself you realise these things? :(
|
coopster

msg:4135347 | 3:04 pm on May 19, 2010 (gmt 0) | Hard to see errors through bloodied eyes :) Glad you got it sorted.
|
whoisgregg

msg:4136019 | 5:02 pm on May 20, 2010 (gmt 0) | Glad you got it sorted out, we've all been there. :) Why is it always after you've publically humiliated yourself you realise these things? :( |
| There's a psychological effect to publishing it online -- you say to yourself, "While I wait for an answer I can think about something else." Once your subconscious mind gets ahold of it, it often finds the answer on it's own.
|
Readie

msg:4136496 | 12:03 pm on May 21, 2010 (gmt 0) | Aye, what I really should do is just go and do something else for 10 minutes, something mundane that takes attention but not thought. I often find that the answer comes to me when I just give up for a few hours - but I never think of that until after it's happened :)
|
|
|