LittleSmudge
Programmer
I know how I'd do this in Access or other RDBs but I can't get it to work in MySQL
For
tblA
AId PK for tblA
tblB
BId PK for tblB
ARef FK to tblA
I need
All records from tblA WHERE there is NOT a record in tblB corresponding to tblA INNER JOIN tblB and tblB.DateRef = 7
( In other words a simple 'missing records' list )
In other dbs this would be
SELECT *
FROM tblA
WHERE tblA.AId
NOT IN ( SELECT tblA.AId
FROM tblA INNER JOIN tblB
ON tblA.AId = tblB.ARef
WHERE tblB.DateRef = 7 )
However, I get a
"You have an error in your SQL syntax near 'SELECT tblA.AId FROM tblA INNER JOIN tblB ON ' at line 1"
error message
It seems that MySQL doesn't like "IN ( SELECT .. .."
So what can I use instead ?
G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
For
tblA
AId PK for tblA
tblB
BId PK for tblB
ARef FK to tblA
I need
All records from tblA WHERE there is NOT a record in tblB corresponding to tblA INNER JOIN tblB and tblB.DateRef = 7
( In other words a simple 'missing records' list )
In other dbs this would be
SELECT *
FROM tblA
WHERE tblA.AId
NOT IN ( SELECT tblA.AId
FROM tblA INNER JOIN tblB
ON tblA.AId = tblB.ARef
WHERE tblB.DateRef = 7 )
However, I get a
"You have an error in your SQL syntax near 'SELECT tblA.AId FROM tblA INNER JOIN tblB ON ' at line 1"
error message
It seems that MySQL doesn't like "IN ( SELECT .. .."
So what can I use instead ?
G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.