Jump to content

LEFT JOIN with "NOT LIKE"


PriteshP23

Recommended Posts

Query:

SELECT UMTS_napetude_cell.parent, UMTS_napetude_nodeb.idnap FROM 
UMTS_napetude_cell LEFT JOIN UMTS_napetude_nodeb
ON UMTS_napetude_cell.parent IS NOT LIKE CONCAT('%',UMTS_napetude_nodeb.idnap,'%')
WHERE UMTS_napetude_cell.parent IS NOT NULL

Error:

 

#1064 - You have an error in your SQL syntax near 'LIKE CONCAT('%', UMTS_napetude_nodeb.idnap,'%')
WHERE UMTS_napetude_cell.parent ' at line 3

 

 

Thanks in advanced.

Link to comment
https://forums.phpfreaks.com/topic/281601-left-join-with-not-like/
Share on other sites

ok, you still didn't answer the first part of the question, do you only get that message when removing the IS.

 

Is this a php based application, is error reporting on? or can you turn it on and do you get any errors?

 

the query could be returning null which is resulting the script to fail. This is all an assumption as I dont know anything about the application.

Connection errors usually indicate timeouts or resultsets that are too large to handle.

 

Using LIKE on a string that starts with an % sign is painfully slow. If the query takes too long to complete, the server or the connection might timeout.

 

How long does the query run before you get this error?

If timeouts aren't the problem then there are two options left; either the resultset is too big (try doing a count() without selecting any columns, and see how many rows the query expectes to return) or the query is causing the MySQL backend to crash, although I would expect an error like "server has gone away" when that happens. However, this is MySQL, nothing is ever what you expect it to be :-)

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.