I use MySQL 3.something that lacks a subselect, and use the IN construct to mimic the missing SUBSELECT construct.
For example a standard SQL statement like
SELECT * from invoice WHERE customerid = (SELECT id FROM customer WHERE sex='F')
is the sort of subselect that doesn't work.
So, I'll dynamically use the subselect:
SELECT id FROM customer WHERE sex='F'
To build a comma-delimited list
1,5,31,255,299
etc.
Then I plug that into:
SELECT * from invoice WHERE customerid IN (1,5,31,255,299)
I BRING THIS UP BECAUSE OF A POTENTIAL DRAWBACK THAT CAN BE AVOIDED with IN constructs:
SELECT * FROM invoice WHERE customerid IN ()
will generate a mysql error.
SELECT * FROM invoice WHERE customerid IN (NULL)
runs just fine.
THEREFORE, when I dynamically build my comma delimited list, I always append a NULL, just in case
SELECT * from invoice WHERE customerid IN (NULL, 1,5,31,255,299)
Note that for this type of subselect, you want to be sure to choose from a column that is NOT NULL. But most columns should be NOT NULL if you follow good database design.