June 29, 2010 at 10:03 am
Hi,
I have a table with columns proj_id char(5), tenant_id char(6), lease_id char(8), Sales_yr numeric(4)
i want to distinct only proj_id, tenant_Id, Lease_id but not sales_yr how can we do that
Thanks,
June 29, 2010 at 10:14 am
rahulsony111 (6/29/2010)
Hi,I have a table with columns proj_id char(5), tenant_id char(6), lease_id char(8), Sales_yr numeric(4)
i want to distinct only proj_id, tenant_Id, Lease_id but not sales_yr how can we do that
Thanks,
To get distinct of what you asked, do:
SELECT DISTINCT proj_id, tenant_Id, Lease_id FROM Table
Nice question, could you please clarify a bit how you want to show sales_yr? Do you want to show maximum, minimum or average value of sales_yr or may be you want to sum it up?
June 29, 2010 at 10:22 am
Eugene Elutin (6/29/2010)
rahulsony111 (6/29/2010)
Hi,I have a table with columns proj_id char(5), tenant_id char(6), lease_id char(8), Sales_yr numeric(4)
i want to distinct only proj_id, tenant_Id, Lease_id but not sales_yr how can we do that
Thanks,
To get distinct of what you asked, do:
SELECT DISTINCT proj_id, tenant_Id, Lease_id FROM Table
Nice question, could you please clarify a bit how you want to show sales_yr? Do you want to show maximum, minimum or average value of sales_yr or may be you want to sum it up?
Just a guess, but you might be wanting the following:
SELECT
proj_id,
tenant_Id,
Lease_id,
sum( sales_yr ) [sales_yr]
group by proj_id, tenant_Id, Lease_id
June 29, 2010 at 12:44 pm
Thank you for the reply,
the Sales_yr is a Year column it has values like 2009, 2010, 2011 etc,...
June 29, 2010 at 2:41 pm
rahulsony111 (6/29/2010)
Thank you for the reply,the Sales_yr is a Year column it has values like 2009, 2010, 2011 etc,...
Cool! It explains everything!
So, you want an average value, isn't it? 😀
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply