|
|
 |
Re: FN-FORUM: sql question
date posted 10th August 2003 17:54
select keycol from table_a where keycol not in (select keycol from
table_b)
can be rewritten for MySQL as:
select a.keycol from table_a a left outer join table_b b on (a.keycol =
b.keycol) where b.keycoll is null;
That should help you convert the query if you are indeed running on
MySQL.
Dave
On Sun, 2003-08-10 at 18:12, PAMELA WHITTAKER wrote:
> O Dear. it is still failing even when SELECT Employee_Id FROM
> greensplash_employees_per_project where Project_Id = 18 does find something.
> Any other ideas please.
>
> Thanks
> Pam
>
>
> ----- Original Message -----
> From: "PAMELA WHITTAKER" [EMAIL REMOVED]
> To: [EMAIL REMOVED]
> Sent: Sunday, August 10, 2003 5:56 PM
> Subject: Re: FN-FORUM: sql question
>
>
> >
> > OOPS - I have just realised that "SELECT Employee_Id FROM
> > greensplash_employees_per_project where Project_Id = '18' " won't find
> > anything. No wonder it is failing.
> >
> > Thanks
> > Pam
> >
> >
> >
> > ----- Original Message -----
> > From: "Alan Sheppard" [EMAIL REMOVED]
> > To: [EMAIL REMOVED]
> > Sent: Sunday, August 10, 2003 5:49 PM
> > Subject: RE: FN-FORUM: sql question
> >
> >
> > >
> > > Pam
> > >
> > > Is project_id a numeric and your testing against a string '18' ?
> > >
> > > Alan S
> > >
> > > On 10 August 2003 17:42, PAMELA WHITTAKER [EMAIL REMOVED]
> > wrote:
> > > >
> > > > I am getting the following error
> > > > You have an error in your SQL syntax near 'SELECT Employee_Id FROM
> > > > greensplash_employees_per_project where Project_Id = '18' at line 1.
> > > >
> > > > I have set the sql string as follows
> > > >
> > > > $sqlstring = "SELECT Employee_Id, Employee_Forename, Employee_Surname
> > FROM
> > > > greensplash_employees_details where Employee_Status = 'Active' AND
> > > > Employee_Id NOT IN (SELECT Employee_Id FROM
> > > > greensplash_employees_per_project where Project_Id = '" .
> > > > $row_Project_Id['Project_Id'] . "') Order By Employee_Forename";
> > > >
> > > > and echo prints out
> > > >
> > > > SELECT Employee_Id, Employee_Forename, Employee_Surname FROM
> > > > greensplash_employees_details where Employee_Status = 'Active' AND
> > > > Employee_Id NOT IN (SELECT Employee_Id FROM
> > > > greensplash_employees_per_project where Project_Id = '18') Order By
> > > > Employee_Forename
> > > >
> > >
> > >
> > >
> > > ==========
> > > fido.net are pleased to sponsor these Freelancers messages. For all
> > > your web hosting needs check out http://www.fido.net/ with hosting
> > > packages starting from just 46.95 a year including VAT.
> > > Free 0871 Fax2Email numbers also available online!
> > > http://www.fido.net/ - the internet made simple! - 0800 1072 666
> > >
> > > To advertise here: http://www.freelancers.net/advertising.html
> > >
> > >
> > ==========
> > fido.net are pleased to sponsor these Freelancers messages. For all
> > your web hosting needs check out http://www.fido.net/ with hosting
> > packages starting from just 46.95 a year including VAT.
> > Free 0871 Fax2Email numbers also available online!
> > http://www.fido.net/ - the internet made simple! - 0800 1072 666
> >
> > To advertise here: http://www.freelancers.net/advertising.html
> >
> >
> ==========
> fido.net are pleased to sponsor these Freelancers messages. For all
> your web hosting needs check out http://www.fido.net/ with hosting
> packages starting from just 46.95 a year including VAT.
> Free 0871 Fax2Email numbers also available online!
> http://www.fido.net/ - the internet made simple! - 0800 1072 666
>
> To advertise here: http://www.freelancers.net/advertising.html
>
> |
 |
|