Solved

Help

Posted on 2008-06-10
4
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 143

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

734 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