subselect doesnt work

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Rossi

    #1

    subselect doesnt work

    hi there, i am trying to remove values from a list menu if the join table
    doesnt have keys when a key is selected for instance:
    locations
    locationID

    locations_join
    locationID shotlistID

    SELECT SQL_NO_CACHE l.locationID , l.location FROM locations l LEFT JOIN
    locations_join lj ON l.locationID = lj.locationID WHERE l.locationID NOT IN
    (select locationID FROM locations_join WHERE shotlistID IN (5069)) ORDER BY
    l.location ASC

    so when shotlistID is selected all the keys from the locations_join joined
    to the shotlistID would be remove from the locations list please help, i'm
    trying to do this in one query saving from getting all the keys into an
    array then checking if the values arent in the array when generating the
    list.


    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe: http://lists.mysql.com/mysql?unsub=ThemC@bp.com


    _______________ _______________ _______________ _______________ ____________
    This email has been scanned for all viruses by the MessageLabs Email
    Security System. For more information on a proactive email security
    service working around the clock, around the globe, visit
    Protect cloud and on-premises email from phishing, ransomware, impersonation, spam and data loss with Symantec.

    _______________ _______________ _______________ _______________ ____________

    --
    MySQL General Mailing List
    For list archives: http://lists.mysql.com/mysql
    To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw

Working...