Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 COMBINE 2 results

Author  Topic 

nguyenl
Posting Yak Master

128 Posts

Posted - 2009-05-22 : 14:35:47
Hi,

Please help.

When I run this "select statement":

Select PropertyNumber, Calculation.annual, Calculation.interest
from PropertyNumber, Claculation
where Property.id = Calculation.property_id
And PropertyNumber = 1238944

I get 2 results:

1 result:

PropertyNumber:1238944
Calculation.annual: .2
Calculation.interest: Null

2 result:

PropertyNumber: 1238944
Calculation.annual: NuLL
Calculation.interest: .12


How do I write a select statment that combines the 2 results?

For example:

PropertyNumber: 1238944
Calculation.annual: .2
Calculation.interest: .12


Thanks,

mualsh
Starting Member

8 Posts

Posted - 2009-05-22 : 15:56:40
You may want to share your table definitions / structures (atleast the relevant columns) along with some sample data.
Go to Top of Page

kira
Starting Member

17 Posts

Posted - 2009-05-22 : 16:56:22
[CODE]
Select PropertyNumber, Calculation.annual, MAX(Calculation.interest)
from PropertyNumber, Claculation
where Property.id = Calculation.property_id
And PropertyNumber = 1238944
GROUP BY PropertyNumber, Calculation.annual
[/CODE]
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-05-23 : 11:11:46
[code]Select PropertyNumber, MAX(Calculation.annual), MAX(Calculation.interest)
from PropertyNumber, Claculation
where Property.id = Calculation.property_id
And PropertyNumber = 1238944
GROUP BY PropertyNumber[/code]
Go to Top of Page
   

- Advertisement -