Re: SELECT ALL and flag

2006-06-06 Thread leo huang
hi, Peter Try this: select a.name, sum(if (b.table_a.id is NULL,0,1)) as indid from table_a a left join table_b b on(a.id=b.table_id.id) group by a.id; best regards, Leo Huang 2006/6/1, Peter Lauri [EMAIL PROTECTED]: Hi, I have a table table_a and table_b: table_a { id name } table_b {

RE: SELECT ALL and flag [solved]

2006-06-01 Thread Peter Lauri
Solved it by: SELECT table_a.name , if( table_a.id = table_b.table_a_id, 1, 0 ) AS theindicator FROM table_a LEFT OUTER JOIN table_b ON ( table_a.id = table_b.table_a_id ) /Peter Hi, I have a table table_a and table_b: table_a { id name } table_b { table_a_id b_value } Table

SELECT ALL and flag

2006-05-31 Thread Peter Lauri
Hi, I have a table table_a and table_b: table_a { id name } table_b { table_a_id b_value } Table A is a table with names, and table B is a table with values for a specific name (optional, therefore a specific table). I would like to select all records in A, done by: SELECT name FROM table_a;