pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
problem join
2+ messages / 2 participants
[nested] [flat]

* problem join
@ 2007-07-27 01:39 chester c young <chestercyoung@yahoo.com>
  2007-07-27 15:47 ` Re: problem join Osvaldo Rosario Kussama <osvaldo_kussama@yahoo.com.br>
  0 siblings, 1 reply; 2+ messages in thread

From: chester c young @ 2007-07-27 01:39 UTC (permalink / raw)
  To: pgsql-sql

having problem joining these correctly:

schedule
- cal_id references calendar not null
- usr_id references users not null
= unique( calZ_id, usr_id )
- result_no not null

activity
- cal_id references calendar not null
- usr_id references users not null
= unique( cal_id, usr_id )
- from_ts timestamp not null

trying to join
- cal_id
- usr_id
- schedule.result_no (might be null)
- activity.from_ts (might be null)
where schedule.usr_id = activity.usr_id would result in one row

thanks for insight!


       
____________________________________________________________________________________
Got a little couch potato? 
Check out fun summer activities for kids.
http://search.yahoo.com/search?fr=oni_on_mail&p=summer+activities+for+kids&cs=bz 



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: problem join
  2007-07-27 01:39 problem join chester c young <chestercyoung@yahoo.com>
@ 2007-07-27 15:47 ` Osvaldo Rosario Kussama <osvaldo_kussama@yahoo.com.br>
  0 siblings, 0 replies; 2+ messages in thread

From: Osvaldo Rosario Kussama @ 2007-07-27 15:47 UTC (permalink / raw)
  To: chester c young <chestercyoung@yahoo.com>; +Cc: pgsql-sql

chester c young escreveu:
> having problem joining these correctly:
> 
> schedule
> - cal_id references calendar not null
> - usr_id references users not null
> = unique( calZ_id, usr_id )
> - result_no not null
> 
> activity
> - cal_id references calendar not null
> - usr_id references users not null
> = unique( cal_id, usr_id )
> - from_ts timestamp not null
> 
> trying to join
> - cal_id
> - usr_id
> - schedule.result_no (might be null)
> - activity.from_ts (might be null)
> where schedule.usr_id = activity.usr_id would result in one row
> 



Try:
SELECT * FROM schedule FULL OUTER JOIN activity
               USING (cal_id, usr_id) ....

Osvaldo




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2007-07-27 15:47 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-07-27 01:39 problem join chester c young <chestercyoung@yahoo.com>
2007-07-27 15:47 ` Osvaldo Rosario Kussama <osvaldo_kussama@yahoo.com.br>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox