Hi MySQL Gurus,
I have a query as in following format:
[code=mysql]
update tbl1, ( subquery )as tbl2
set tbl1.col1 = IFNULL(tbl2.col 1,0)
where tbl1.col2 = tbl2.col2[/code]Here, Actually i am returning a count of a column from tbl2 which is set to col2 of tbl1. it is perfectly running whenever tbl2 has count of 1 or more. when there is no count or theres is no count it does not return zero so ultimately my query fails for this particular condition.
How can i assign a value zero to tbl1.col2 when there is no result exist for that particular row
Thanks in advance
I have a query as in following format:
[code=mysql]
update tbl1, ( subquery )as tbl2
set tbl1.col1 = IFNULL(tbl2.col 1,0)
where tbl1.col2 = tbl2.col2[/code]Here, Actually i am returning a count of a column from tbl2 which is set to col2 of tbl1. it is perfectly running whenever tbl2 has count of 1 or more. when there is no count or theres is no count it does not return zero so ultimately my query fails for this particular condition.
How can i assign a value zero to tbl1.col2 when there is no result exist for that particular row
Thanks in advance
Comment