I have a SQL statement like this: SELECT table1.*,table2.field1 FROM table1 LEFT JOIN table2 ON (something) WHERE (something_else) I want field1=1 instead of null if there is no record in table2. How to do this. Please help. Thanks.
SELECT table1.*,coalesce(table2.field1,1) FROM table1 LEFT JOIN table2 ON (something) WHERE (something_else)
Awesome!! Works perfect. Always learn something new on every question in here.