If you need to use subqueries, you need to upgrage to MySQL 4.1.x.

In 4.0.14 you can restructure your query using a LEFT JOIN on the tables.

something like (untest):

SELECT main.filename FROM main
LEFT JOIN GALLERY_DATA ON main.filename=GALLERY_DATA.filename;

In article <biok8q$ta6$1news6.svr.pol.co.uk>,
"Mark" <markvanrossumNOSPAMyahoo.co.uk> wrote:
> (hey, FAST response cheers!)
> Sorry, yep MY SQL:
>
> MySQL 4.0.14-standard running on .....etc
>
> (and using PHPMyADMIN to run the queries at the mo, when it works it will go
> in a PHP script...)
>
> "Andy Hassall" <andyandyh.co.uk> wrote in message
> news:23lvkv8aqeq4kb3tckenhc0cd1h2uos6dg4ax.com...
> > On Fri, 29 Aug 2003 23:32:11 +0100, "Mark"
> <markvanrossumNOSPAMyahoo.co.uk>
> > wrote:
> >
> > >Arghhh, OK I am stuck so any help would be appreciated:
> > >SQL:
> > >SELECT filename
> > >FROM main
> > >WHERE filename NOT
> > >IN ( SELECT filename from GALLERY_DATA )
> > >
> > >Answer:
> > >You have an error in your SQL syntax. Check the manual that corresponds
> to
> > >your MySQL server version for the right syntax to use near 'SELECT
> filename
> > >FROM GALLERY_DATA )
> > >
> > >I'm tearing my hair out, what the "($$( is wrong with my SQL? I've
> copied
> > >examples of websites (and modified the table/field names obviously) and
> they
> > >don't work either.
> > >
> > >Oh, I know a join is faster, but they are only v small tables so
> irrelevant.
> > >(and i don't know what/how to do joins!)
> >
> > The error says you're using MySQL. Which version are you using?
> >
> > Always post database type, and version, as SQL syntax and features differ
> > wildly between databases.
> >
> > MySQL 3.x does not support subqueries.
> >
> > --
> > Andy Hassall (andyandyh.co.uk) icq(5747695) ([url]http://www.andyh.co.uk[/url])
> > Space: disk usage ysis tool ([url]http://www.andyhsoftware.co.uk/space[/url])
>
>