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.
| Author |
Topic |
|
satish.gorijala
Posting Yak Master
182 Posts |
Posted - 2009-01-20 : 07:48:07
|
| ENG IND AMER35 4 23 6 13 28 547 3 1 My requirement is retrieve the data where “ENG” is high in corresponding rows.For example:Take first row, here 35 is highest and it belongs to ENGTake second row, here 6 is highest and it belongs to INDTake third row, here 28 is highest and it belongs to INDTake 4th row, here 47 is highest and it belongs to ENG. Now I want to retrieve the data as followsENG3547G. Satish |
|
|
ra.shinde
Posting Yak Master
103 Posts |
Posted - 2009-01-20 : 07:53:57
|
| if data is likeENG IND AMER5 3 8then what you want?Rahul Shinde |
 |
|
|
satish.gorijala
Posting Yak Master
182 Posts |
Posted - 2009-01-20 : 07:55:36
|
Suppose, if u have 50 rows in the table. I want to retrive the rows where ENG is high. Suppose for 10 rows, the ENG is high among 50. I need that 10 rows as resultquote: Originally posted by ra.shinde if data is likeENG IND AMER5 3 8then what you want?Rahul Shinde
G. Satish |
 |
|
|
ra.shinde
Posting Yak Master
103 Posts |
Posted - 2009-01-20 : 08:03:16
|
| DECLARE @TABLENAME TABLE(ENG int, IND int, AMER int)insert into @TABLENAMESELECT 35, 4, 2union allselect 3, 6, 1union all select 3, 28, 5union allselect 47, 3, 1select ENG FROM @TABLENAMEWHERE ENG > IND and ENG > AMERRahul Shinde |
 |
|
|
ra.shinde
Posting Yak Master
103 Posts |
Posted - 2009-01-20 : 08:09:17
|
quote: Originally posted by harsh_athalye
select Engfrom tblwhere Eng > Ind and Ind > Amer Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED"
if Eng > Amer > Ind then your query will not return itRahul Shinde |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2009-01-20 : 08:22:41
|
| True. Deleted my earlier solution.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
|
|
|
|
|