List:General Discussion« Previous MessageNext Message »
From:Gerald Clark Date:July 25 2002 7:44pm
Subject:Re: how to retrieve data from two table?
View as plain text  

Dermot Paikkos wrote:

>I have be scratching my head with this for a few days.
>I want to select data from 2 tables conditionally. 1 table has users, 
>the other times relating to the users. I want to create a query that 
>will select the user from the users table and if they have any time 
>data against them (for that day) return that also. If there is not data 
>for that day only the user data should be returned.
>If I do:
>FROM users u LEFT OUTER JOIN times t
>ON ( 
>WHERE = 22;
>I get:
>Which I could work with but once I add "AND = (current_date)
AND  ( = (current_date) or IS NULL )

>I get 0 records returned and I need the an users.surname.
>Can anyone think of a way round this?
>Dermot Paikkos * dermot@stripped
>Network Administrator @ Science Photo Library
>Phone: 0207 432 1100 * Fax: 0207 286 8668
>Before posting, please check:
>   (the manual)
>           (the list archive)
>To request this thread, e-mail <mysql-thread115548@stripped>
>To unsubscribe, e-mail
> <>
>Trouble unsubscribing? Try:

how to retrieve data from two table?Dermot Paikkos25 Jul
  • Re: how to retrieve data from two table?Benjamin Pflugmann25 Jul
  • Re: how to retrieve data from two table?Gerald Clark25 Jul
  • Re: how to retrieve data from two table?Dicky Wahyu Purnomo26 Jul