If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > NOT IN sytnax

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-14-04, 19:16
pokermagic pokermagic is offline
Registered User
 
Join Date: Oct 2003
Location: santa clara
Posts: 25
NOT IN sytnax

I have a SQL that I can't get to work and I think I have the syntax incorrect. Here it is.

SELECT DISTINCT manufacturers.mfrid, manufacturers.mfrname FROM manufacturers, models, oemmemory, crossref, pdppart, exclude WHERE manufacturers.mfrid = models.mfrid AND models.modelid = oemmemory.modelid AND crossref.crossrefid = oemmemory.crossrefid AND crossref.crossrefid = pdppart.crossrefid AND models.modelid not in(select exclude.modelid from exclude) AND models.catid = ? ORDER BY manufacturers.mfrname;

Basically it tells me I have an error near the select exclude.modelid from exclude.

What I'm trying to do is to get a list of models but not ones that are listed in the exclude table.

Thanks for any help.
Reply With Quote
  #2 (permalink)  
Old 07-14-04, 21:34
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
subqueries not supported before version 4.1

try this --
Code:
select distinct 
       manufacturers.mfrid
     , manufacturers.mfrname 
  from manufacturers
inner
  join models
    on manufacturers.mfrid 
     = models.mfrid 
inner
  join oemmemory
    on models.modelid 
     = oemmemory.modelid 
inner
  join crossref
    on oemmemory.crossrefid  
     = crossref.crossrefid 
inner
  join pdppart
    on crossref.crossrefid 
     = pdppart.crossrefid
left outer
  join exclude 
    on models.modelid
     = exclude.modelid
 where models.catid = 937 
   and exclude.modelid is null
order 
    by manufacturers.mfrname
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On