Re: [GENERAL] join table with empty fields and default

2006-07-22 Thread Michael Fuhr
On Sat, Jul 22, 2006 at 01:38:38PM -0700, [EMAIL PROTECTED] wrote: > Suppose I have another table UserInformation > > UserInfomation > { > userid integer referenes user(id), > mothername text > } > > I would like methername also appear in the final join. Suppose each > user must have a m

Re: [GENERAL] join table with empty fields and default

2006-07-22 Thread quickcur
Thank you for your post. To make things a little bit complicated: Suppose I have another table UserInformation UserInfomation { userid integer referenes user(id), mothername text } I would like methername also appear in the final join. Suppose each user must have a mothername. Could yo

Re: [GENERAL] join table with empty fields and default

2006-07-22 Thread Michael Fuhr
On Sat, Jul 22, 2006 at 12:47:42PM -0700, [EMAIL PROTECTED] wrote: > I would like to join table user and userwork, where if a user has a > work, I list it. If he does not, I give it some default value "no work" You could use an outer join and COALESCE. http://www.postgresql.org/docs/8.1/interacti

[GENERAL] join table with empty fields and default

2006-07-22 Thread quickcur
Hi, suppose I have two tables table User { id integer, name text, address text } Table UserWork { userid integer references User(id), work text } Suppose I have three users idnameaddress 1 Tony main street 2 Peter Big ave 3 Richard Loop Blvd An