.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Forum >> Sql Server >> Post New QuestionBookmark and Share Subscribe to Forum

getting id from the table

Posted By: Rajesh     Posted Date: April 02, 2010    Points:2   Category :Sql Server
how to get id where value>50000 ( every id exits more times)
ex: customer
id value
1 2000
2 3000
1 4000
2 3000

Author: Sagar Pardeshi             
Posted Date: April 02, 2010     Points: 5   

Hi check

following query

select DISTINCT ID from  customer where Values>5000

Author: Rajesh             
Posted Date: April 02, 2010     Points: 5   

but i want that value should be added according to customer id and then check for condition. ur's query will return only the distinct customers who are separately having value>5000

Thank u for Replay . pls check this condition also

Author: Dilip             
Posted Date: April 02, 2010     Points: 5   

Hello Rajesh

Your question is still not clear...Can you explain by giving example of the output you require.

Author: Dilip             
Posted Date: April 02, 2010     Points: 5   

I think this might be your question:

You want to Sum the "value" based on the "id" and then check the condition of >50000

If this is so then this is the query:

Select id,SUM(value) group by id having SUM(value) > 50000


Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend