Wednesday 15 February 2012

MySQL DELETE FROM with UNION subquery by IN condition -


I tripped on a strange SQL error. The last query does not work. Of course, I can divide the answer in only three questions, but I wonder why MySQL does not allow me to do this.

A small example:

  (  

works!

   

 << P>  

while

  

  from the starting point to that place Delete (Select from buildings where building = 123) (Choose Building = 123) for Elevation (Select from the idle ID = Building = 123) ID   

error Raises

# 1064 - There is an error in your SQL syntax; To use Union (Select ID for Lift Libre of Building = 123), check the manual related to your MySQL server edition for the correct syntax. (Selection ID FROM qrc 'on line 3')

Any clues?

Try that SQL

  Remove from the starting point WHERE id IN (selection ID where the building = 123 from the Union Select ID where the building = 123 union selection ID from qrcodeid where building = 123) stairs with the selection ID    

No comments:

Post a Comment