Re: Not In join query.

2007-10-13 Thread Baron Schwartz
Hi Chris, Chris W wrote: I have 2 queries to give me a list of names. Q1: SELECT DISTINCT FName, LName FROM user u JOIN userprofile p USING ( UserID ) JOIN trainingstatus t USING ( UserID ) WHERE ProgramID =12 ORDER BY LName, FName Q2 SELECT DISTINCT FName, LName FROM namelist WHERE `Date` Wh

Re: NOT IN vs IS NULL

2006-02-02 Thread Devananda
Shawn, I've just found out that most of my emails during this discussion were NOT posted to the list because I was sending mail in HTML format and Yahoo was not delivering the bounce notices to me. That explains why you believed I was not listening to Peter's input - only _his_ messages were

Re: NOT IN vs IS NULL

2006-02-01 Thread SGreen
You are correct, that the situation you describe was not clearly presented in your previous reply. I humbly apologize for any offense. Using the EXPLAIN you posted in your latest reply, you can translate your subquery into the following JOINed query SELECT p.offer_id FROM paytable p LEFT JOIN

Re: NOT IN vs IS NULL

2006-02-01 Thread Devananda
[EMAIL PROTECTED] wrote: Devananda, I have to support Peter on this one. What he submitted to you is a perfectly appropriate solution. It seems as though you rejected his assistance before even trying to see if it would work. On the contrary, I have tried his suggestions and they do not work

Re: NOT IN vs IS NULL

2006-02-01 Thread SGreen
Devananda, I have to support Peter on this one. What he submitted to you is a perfectly appropriate solution. It seems as though you rejected his assistance before even trying to see if it would work. There have been and continue to be SQL-driven databases around that have not had and do not

Re: NOT IN vs IS NULL

2006-01-31 Thread Peter Brawley
Devananda, >Definitely not. The first LEFT JOIN, with the clauses >"ON pt.login_id=pab1.login_id ... WHERE pab1.login_id IS NULL", > does not make sense. ?!? It's a standard JOIN replacement for NOT IN (...). >There is not a 1to1 relationship, These joins neither find nor assume 1:1 rela

Re: NOT IN vs IS NULL

2006-01-31 Thread Peter Brawley
Devananda, OK, get the diescription in ordinary language right, and the query ought to write itself. Your schema is like this? ... and you want the paytable rows   (i) for which there is an offers row matching paytable.offer_id, and   (ii) for which there is no pab row where pab.login_

Re: NOT IN vs IS NULL

2006-01-27 Thread Peter Brawley
Devananda, >Could anyone give me some insight as to which of the following queries >is "better" (and why) - or if there is another query that would be faster than either? It's late on Friday so I could be missing something, but wouldn't the following be simpler? SELECT offer_id FROM paytab

Re: NOT IN

2002-12-02 Thread DL Neil
> Select * from employees left outer join dept on employees.emp_DepId = > dept.dep_id where dept.dep_id is null > > (Subselect would be easier if MySQL supported it!) Likely easier to write, but equally likely to be more expensive to run (on any tbl of realistic size) NB Comment only pertinent a

RE: NOT IN

2002-12-02 Thread Cal Evans
Select * from employees left outer join dept on employees.emp_DepId = dept.dep_id where dept.dep_id is null (Subselect would be easier if MySQL supported it!) HTH, =C= * * Cal Evans * The Virtual CIO * http://www.calevans.com * -Original Message- From: Silmara [mailto:[EMAIL PROTECTED]]

Re: Not in Another Table

2002-01-08 Thread Dibo Chen
select a.* from a left join b on a.id = b.id where b.id is null; Ken Kinder wrote: > > Is there a way I can filter OUT records referenced in another table? > > With Subselects it would be this, but I'm using 3.23: > > select > a.* > from > a > where > a.id not in (select id from b) >

Re: Not In

2001-12-13 Thread Kevin Smith
gt; mysql> > > > > - Original Message - > From: "Kevin Smith" <[EMAIL PROTECTED]> > To: "Mohamed Abd El-Samei Mohamed" <[EMAIL PROTECTED]> > Sent: Thursday, December 13, 2001 2:25 PM > Subject: Re: Not In > > > > Post the

Re: not in -- not exists

2001-12-13 Thread Kodrik
> Dear all can anyone help me to use NOT IN > > or NOT EXISTS command in mysql .. You need to use left join the table and look for an inexisting link select * from table 1 left join table2 on table2.key1=table1.id where whatever and table2.id is null -

Re: not in -- not exists

2001-12-13 Thread Kodrik
> Dear all can anyone help me to use NOT IN > > or NOT EXISTS command in mysql .. You need to use left join the table and look for an inexisting link select * from table 1 left join table2 on table2.key1=table1.id where whatever and table2.id is null -

RE: not in -- not exists

2001-12-13 Thread Roger Baklund
* Mohamed Abd El-Samei Mohamed > Dear all can anyone help me to use NOT IN > > or NOT EXISTS command in mysql .. None of these are commands... NOT IN was introduced in version 3.21.14a, it is a variant of the IN comparison operator. From the manual: `expr NOT IN (value,...)' Same as `NO

Re: not in -- not exists

2001-12-13 Thread sherzodR
CREATE TABLE IF NOT EXISTS table_name ( id NOT NULL AUTO_INCREMENT PRIMARY KEY, value VARCHAR(30) ); Mohamed Abd El-Samei Mohamed wrote: MAEM: Date: Thu, 13 Dec 2001 13:59:46 +0200 MAEM: From: Mohamed Abd El-Samei Mohamed <[EMAIL PROTECTED]> MAEM: To: [EMAIL PROTEC

Re: NOT IN query problems.

2001-09-07 Thread Paul DuBois
At 4:40 PM -0700 9/7/01, Anthony E. wrote: >I've tried to do a NOT IN statement, but still am >getting SQL syntax error. > > >SELECT COUNT(*) FROM USER_TMP WHERE USER_TMP.email NOT >IN (SELECT USER.email FROM USER); > >I'm trying to produce a list of records from USER_TMP Huh? COUNT(*) produces

Re: Re: NOT IN

2001-07-16 Thread Bernhard Doebler
o: "Beatriz Lapaz" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, July 16, 2001 10:57 AM Subject: Re: NOT IN > > here the script in php in eine classe eingebaut. > - Before posting, plea

Re: NOT IN

2001-07-16 Thread Gerlinde Fischer
At 09:31 16.07.01 +0200, Beatriz Lapaz wrote: >Hi!! > >I'm working with PHP and I use MySQL. I've just known that in MySQL >doesn't exist NESTED SELECTS and it's a problem for me. >I'd need a query to get all the ids from a table which are not in another >table. Something like that: > >SELECT TA