RE: SELECT this IF that

2002-03-07 Thread Forer, Leif
name', > SUM(log.hours) AS 'hours' > FROM log LEFT OUTER JOIN empnum > ON log.id = empnum.id > WHERE log.pj = '$pj' GROUP BY id; -Original Message- From: DL Neil [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 05, 2002 6:42 PM To: Forer, Leif; 'Nathan

RE: SELECT this IF that

2002-03-05 Thread Bill Easton
You can do what you asked for by making a temporary table, as follows. create temporary table T (this varchar(..), that varchar(..)); insert into T select tbl1.this, "no record" from tbl1 left join tbl2 on tbl1.id = tbl2.id where tbl2.id is null; insert into T select tbl1.this, tbl2.that from tbl

Re: SELECT this IF that

2002-03-05 Thread DL Neil
Leif, > I'm not sure what you mean by "tbl2's population is a sub-set of that > in tbl1". tbl1 contains user id nums and hours each user spent working on a > project. tbl2 contains user id nums and the first and last names that > correspond to each user id. There are user id nums in tbl1 that

RE: SELECT this IF that

2002-03-05 Thread Weaver, Walt
fields that are null. :>) --Walt -Original Message- From: Forer, Leif [mailto:[EMAIL PROTECTED]] Sent: Tuesday, March 05, 2002 1:58 PM To: 'DL Neil'; 'Nathan'; [EMAIL PROTECTED] Subject: RE: SELECT this IF that DN- I'm not sure what you mean by "tbl2's pop

RE: SELECT this IF that

2002-03-05 Thread Forer, Leif
DN- I'm not sure what you mean by "tbl2's population is a sub-set of that in tbl1". tbl1 contains user id nums and hours each user spent working on a project. tbl2 contains user id nums and the first and last names that correspond to each user id. There are user id nums in tbl1 that do not exi

Re: SELECT this IF that

2002-03-05 Thread Nathan
Um, if there aren't any records in tbl1.id that match tbl2.id, it will return zero records. I am not away of the ability to output strings as custom errors, but you will get an Empty Set result. You can use that result in whatever front-end language you are using to output anything you like. D

Re: SELECT this IF that

2002-03-05 Thread DL Neil
Leif, > I want to select and join data from two tables if the same id exists in both > tables. If the id only exists in one table I want MySQL to return a string > like "sorry, no records found". How can I do this? > > I'm guessing it's something like: > > mysql> SELECT tbl1.this, tbl2.that FRO