Jump to content

help with query syntax


dflow

Recommended Posts

#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 'LIMIT 0, 30' at line 5

SELECT *
FROM `apartments`
WHERE city_id
IN ( 3, 4, 5 ) AND DESC ='' and RIGHT(ID,(SELECT * FROM apartments WHERE ID IN (2,3))
[code]

Link to comment
https://forums.phpfreaks.com/topic/244934-help-with-query-syntax/
Share on other sites

couldn't you just do :

SELECT *
FROM apartments
WHERE city_id
IN ( 3, 4, 5 ) AND DESCRIPTION ='' AND ID IN (SELECT ID FROM apartments WHERE ID LIKE '%1' OR ID LIKE '%4' OR ID LIKE '%6' OR ID LIKE '%7')

 

Still don't see where your LIMIT statement is that is mentioned in the actual error though.

couldn't you just do :

SELECT *
FROM apartments
WHERE city_id
IN ( 3, 4, 5 ) AND DESCRIPTION ='' AND ID IN (SELECT ID FROM apartments WHERE ID LIKE '%1' OR ID LIKE '%4' OR ID LIKE '%6' OR ID LIKE '%7')

 

Still don't see where your LIMIT statement is that is mentioned in the actual error though.

 

THANKS

couldn't you just do :

SELECT *
FROM apartments
WHERE city_id
IN ( 3, 4, 5 ) AND DESCRIPTION ='' AND ID IN (SELECT ID FROM apartments WHERE ID LIKE '%1' OR ID LIKE '%4' OR ID LIKE '%6' OR ID LIKE '%7')

 

Still don't see where your LIMIT statement is that is mentioned in the actual error though.

 

+1 to fenway *shudder* ...        but anyway......a subselect to do that?.... why if  RIGHT() also exist

Typos, secrets, and apparently not the "real" query...  Post the entire query exactly how you have it.

 

You're missing a terminating parenthesis:

(ID,(SELECT * FROM apartments WHERE ID IN (2,3))

//this is what I started off with
SELECT *
FROM `apartments`
WHERE city_id
IN ( 3, 4, 5 ) AND Description ='' and RIGHT(ID,(SELECT * FROM apartments WHERE ID IN (2,3))

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.