Re: Outer Join with Criteria

2007-05-15 Thread Sebastian Mendel
Ed Since schrieb: > Hello, I'm wondering if this is the most effective way of doing an outer > join with 'extra criteria' (I don't feel like it's the best way): > > SELECT e.EventID, ue.Contact, ut.Discount > FROM Event e > LEFT OUTER JOIN > (SELECT EventID, Contact FROM UserEvent WHERE UserId =

Re: outer join question

2007-02-05 Thread KMiller
Thanks much! ViSolve DB Team-2 wrote: > > Hello, > > Try this... > > select a.rhrqid,a.rhrqsid,a.rhrssid,b.sid,b.rlsid > from rqhistory a left join relay b > on (a.rhrqid = b.rqid and (a.rhrqsid = b.rlsid or a.rhrqsid = b.sid or > a.rhrssid = b.rlsid or a.rhrssid = b.sid)) > where a.rhrqsi

Re: outer join question

2007-02-05 Thread ViSolve DB Team
Hello, Try this... select a.rhrqid,a.rhrqsid,a.rhrssid,b.sid,b.rlsid from rqhistory a left join relay b on (a.rhrqid = b.rqid and (a.rhrqsid = b.rlsid or a.rhrqsid = b.sid or a.rhrssid = b.rlsid or a.rhrssid = b.sid)) where a.rhrqsid = 101 or a.rhrssid = 101 Thanks, ViSolve DB Team - Ori

Re: OUTER JOIN bug in 5.0.1?

2004-09-21 Thread SGreen
Thanks! Between the ERD and your descriptions I think I've got it. Most of the others on this list who have designed a system like yours (gradebooks or attendance taking) designed it so that it supported multiple instructors for multiple courses each of which have their own class schedules (at

Re: OUTER JOIN bug in 5.0.1?

2004-09-21 Thread Josh Trutwin
On Tue, 21 Sep 2004 10:49:31 -0400 [EMAIL PROTECTED] wrote: > Hmmm. you want to see a student, all of the classes they are > enrolled in and how many times they attended? I understand the > relationships between the student, class, and class_attended tables > (that's all related to attendance and

Re: OUTER JOIN bug in 5.0.1?

2004-09-21 Thread SGreen
Josh Trutwin <[EMAIL PROTECTED]> wrote on 09/21/2004 09:40:03 AM: > On Tue, 21 Sep 2004 08:57:21 -0400 > [EMAIL PROTECTED] wrote: > > > > > > Perhaps another example would help. I've been trying to re-write > another join query that's designed to produce an attendance record for > each stude

Re: OUTER JOIN bug in 5.0.1?

2004-09-21 Thread Josh Trutwin
On Tue, 21 Sep 2004 08:57:21 -0400 [EMAIL PROTECTED] wrote: > There are up to three layers of record filtering that happen during > any query. First is the JOIN filtering. That is where the ON > conditions are used with the table declarations to build a virtual > table that consists of all colu

Re: OUTER JOIN bug in 5.0.1?

2004-09-21 Thread SGreen
Josh Trutwin <[EMAIL PROTECTED]> wrote on 09/20/2004 10:41:46 PM: > On Mon, 20 Sep 2004 10:25:16 -0400 > [EMAIL PROTECTED] wrote: > > > I think you missed my point. I think the 5.0.1 behavior was correct > > and the others are wrong. There is a known bug (or two) about mixing > > outer joins and

Re: OUTER JOIN bug in 5.0.1?

2004-09-20 Thread Josh Trutwin
On Mon, 20 Sep 2004 10:25:16 -0400 [EMAIL PROTECTED] wrote: > I think you missed my point. I think the 5.0.1 behavior was correct > and the others are wrong. There is a known bug (or two) about mixing > outer joins and inner joins and it looks like it may be fixed. IF > you want to see all of the

Re: OUTER JOIN bug in 5.0.1?

2004-09-20 Thread SGreen
I think you missed my point. I think the 5.0.1 behavior was correct and the others are wrong. There is a known bug (or two) about mixing outer joins and inner joins and it looks like it may be fixed. IF you want to see all of the students THAT TABLE (students) needs to be on the LEFT side of a

Re: OUTER JOIN bug in 5.0.1?

2004-09-20 Thread Josh Trutwin
On Mon, 20 Sep 2004 09:33:56 -0400 [EMAIL PROTECTED] wrote: > Sounds like your 4.0.20 may be the buggy installation... let me see > if I can explain. Except this is a 5.0.1 installation. The query worked as is in 4.0.20 (and it also worked in 5.0.0), only after playing with 5.0.1 did the results

Re: OUTER JOIN bug in 5.0.1?

2004-09-20 Thread SGreen
Sounds like your 4.0.20 may be the buggy installation... let me see if I can explain. Let's analyze your FROM clause and imagine there is no WHERE clause, for the moment: FROM student s INNER JOIN enrollment e ON e.tech_id = s.tech_id INNER JOIN submitted_assignment sa ON sa.tech_id = s.tech_id

Re: outer join

2004-05-18 Thread Mike Hillyer
The (+) indicates an OUTER JOIN. This should work: SELECT A1.store_name, SUM(A2.Sales) SALES FROM Georgraphy A1 LEFT JOIN Store_Information A2 ON A1.store_name = A2.store_name GROUP BY A1.store_name; Scott Purcell wrote: Hello, I am working through a sql tutorial, and would like to perform this (wr

Re: Outer join question

2004-01-20 Thread Craig A. Finseth
First, you database design. You don't need to separate actresses from actors... Why do that? They are the same entity, a person, with only one different attribute: the genre. So, you should join them in one single table: ... Actually, it is possible to be female and to be an Ac

[Fwd: Re: Outer join question]

2004-01-20 Thread Diana Soares
Sorry, i meant "gender", not "genre". -Forwarded Message- First, you database design. You don't need to separate actresses from actors... Why do that? They are the same entity, a person, with only one different attribute: the genre. So, you should join them in one single table: Actors ==

Re: Outer join question

2004-01-20 Thread Diana Soares
First, you database design. You don't need to separate actresses from actors... Why do that? They are the same entity, a person, with only one different attribute: the genre. So, you should join them in one single table: Actors == act_id name genre ENUM('m','f') Then, the table DVD. If we ma

Re: Outer join question

2004-01-19 Thread daniel
> [EMAIL PROTECTED] wrote: >>> DVD_Actor: >>> dvd_ID REFERENCES DVD >>> actor_ID REFERNCES Actor >> >> Is this how you setup a join table ? > > Yes. > > >> what exactly is the references keyword ? > > It indicates a foreign key. Full syntax is something like: > dvd_ID CONSTRAINT dvc_fk FOREIGN KEY

Re: Outer join question

2004-01-19 Thread Jochem van Dieten
[EMAIL PROTECTED] wrote: DVD_Actor: dvd_ID REFERENCES DVD actor_ID REFERNCES Actor Is this how you setup a join table ? Yes. what exactly is the references keyword ? It indicates a foreign key. Full syntax is something like: dvd_ID CONSTRAINT dvc_fk FOREIGN KEY REFERENCES DVD (dvd_ID) Read the ma

Re: Outer join question

2004-01-19 Thread daniel
> > DVD_Actor: > dvd_ID REFERENCES DVD > actor_ID REFERNCES Actor > Is this how you setup a join table ? what exactly is the references keyword ? -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

Re: Outer join question

2004-01-19 Thread Jochem van Dieten
Bjorn Barton-Pye wrote: I am using a test database to teach myself MYSQL and am using my DVD collection as the subject. I have 3 tables in this example: Actresses === actr_id name Actors == acto_id name DVD == Title acto_id actr_id The acto_id and actr_id in the DVD table indicates the

Re: Outer join question

2004-01-19 Thread daniel
> so soemthing like > > select * from dvd left join actresses actr on actr.actr_id=dvd.actr_id > left join actors acto on acto.acto_id=dvd.acto_id or by dvd.title > > totally forgot, to get a really good query especially when you use Innodb it doesnt like null values on foreign keys, i'd setup a r

Re: Outer join question

2004-01-19 Thread daniel
> So, can somebody please correct the following query (and explain the > syntax) so that it will work please? (I haven't tried putting an outer > join in it because I don't understand the syntax.) > > Select > actr.name, > acto.name, > dvd.title > from > actresses actr, >

RE: OUTER JOIN

2003-06-18 Thread David Shelley
Try something like select distinct S.US_FOLIO US_FOLIO , ifnull(SD.US_FOLIO,'false') FOLIO2 from SEGUIMIENTO S LEFT OUTER JOIN SEGUIMIENTO_DETALLE SD on (S.US_FOLIO=SD.US_FOLIO) -Original Message- From: Gustavo Mejia [mai

Re: outer join + count() + group by

2002-02-13 Thread Anvar Hussain K.M.
Hi, Yes I have made some mistakes. There was problem with the outer join. It should have been ad outer joined to review, not the other way. I didn't notice the first tabel person in the query. Try the following with two tables ad and review and later add person table. We don't know the column

Re: outer join + count() + group by

2002-02-12 Thread Jon Drukman
At 01:43 AM 2/12/2002, you wrote: >Hi, >Does this work for you? > >select ad.id,adtype,name,sum(review.id is not null) from person >review left join ad on ad.id=review.id >group by ad.id; this one returns 1 for the sum column no mater what. >select ad.id,adtype,name,sum(if (ifnull(review.id,0)=

Re: outer join + count() + group by

2002-02-12 Thread Anvar Hussain K.M.
Hi, Does this work for you? select ad.id,adtype,name,sum(review.id is not null) from person review left join ad on ad.id=review.id group by ad.id; OR select ad.id,adtype,name,sum(if (ifnull(review.id,0)=0,0,1)) from person review left join ad on ad.id=review.id group by ad.id; Anvar. At 06:13

Re: outer join question

2001-11-30 Thread Steve Werby
"Harlan Feinstein" <[EMAIL PROTECTED]> wrote: > I've joined them an SQL statement that looks like this: > > select val, status > from A > left outer join B on val=id; > > What I'd LIKE is a 90-row result set, with the "status" field from table B > when there was data available. What I'm getting i