Jump to content

If foreign key doesn't exist? How?


imperium2335

Recommended Posts

you could do something like this, but it may use up alot of resources depending on table sizes etc..

 

SELECT * FROM invoices WHERE invoices.jobRef NOT IN (SELECT id FROM JOBS)

 

Im sure there are better ways of doing this, but this should get it working until you find them,

 

to save on resources it may be better to get the list of job id's in one query and then just pass them into this one instead, to save mysql re-running the subquery multiple times

 

Regards

 

DK

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.