Jump to content

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))

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.