Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing Nulls with 0s in Left Outer Join query

Status
Not open for further replies.

jabmod

MIS
Sep 12, 2004
68
US
How could one replace the Null values on a column joined with the Left Outer Join command to zeros - 0

This would make it possible to do some calculation with the colum. Currently I am getting Nulls when I subtract that column from another.

Thanks you.
 
Just make the select query into an Update query. Specify the table with the Nulls as the table to update. Or you could just update all of the Nulls in that table.
And then there is the ISNULL() function that would allow you to do math without making an update to the table.
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Code:
select t1.field1, isnull(t2, 0.0) * t1.field1
from table1 t1 left join on table2 t2 on t1.idfield = t2.idfield

Is this something like what you might want?

Questions about posting. See faq183-874
Click here to learn Ways to help with Tsunami Relief
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top