Solved

Help

Posted on 2008-06-10
4
168 Views
Last Modified: 2010-03-20
Please help me with a sql query. I have a view with couple of joined tables which displays the results as
Name, Top,  Bottom and some other fields. The results looks like
AA  0      100
AA  100    175
AA   150   200
Now i need only one record for the above results as AA  0  200. Min of Top and Max of Bottom for each name.

Thanks
0
Comment
Question by:krisyash
  • 2
4 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 21756784
in short:
select Name, min(top), max(Bottom)from yroutable group by Name

Open in new window

0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 21758198
if angelIII solution doesn't work, try:
select distinct name
, (select min(YourFieldName) from YourTable where Name = A.Name)
, (select max(YourOtherFieldName) from YourTable where Name = A.Name)
from YourTable AS A
0
 

Author Comment

by:krisyash
ID: 21761000
Thank You all..I think its working.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 21762957
You need to accept one of the comment to close the question
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now