>>Can the following be done:
>>
>>Table 1: PARTS
>>Fields : PART_NO, and other
>>
>>Table 2: PARTSUSED
>>Fields : PART_NO, QTY_USED, DATE_USED, and other fields
>>
>>I want to create a query of parts with sum qty used. But the trick is that I want the parts that have not been used during selected period would show in the query with qty equal to 0 (and not NULL).
>>
>>Example:
>>
>>select PART_NO, sum( QTY_USED) as qty_sum from PARTS ;
>>left join PARTSUSED on PART_NO.PART_NO = PARTSUSED.PART_NO where (DateFilter)
>>
>>This query will have all parts in PARTS table but the QTY_SUM for those that don't have records in PARTSUSED will show as NULL. How can I make the NULL to be 0 (zero)?
>>
>>TIA.
>
>
select parts.PART_NO, sum( nvl(QTY_USED,0) ) as qty_sum ;
> from PARTS ;
> left join PARTSUSED on PARTs.PART_NO = PARTSUSED.PART_NO
> where (DateFilter)
Cetin
Thank you so much. I didn't know of the function, NVL().
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham