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 |
|
anjan
Starting Member
21 Posts |
Posted - 2005-09-25 : 11:56:32
|
| I'm converting a project to sql server , which is in access now.plz helpme reg this.What is the equivalent function in SQL SERVER to get the first value of a column.we use FIRST(COLUMN) in Access.it's urgenthope reply soon.... |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-09-25 : 13:00:11
|
to get the first value you have to order the column by something, so:select top 1 col1 from table1 order by col1Go with the flow & have fun! Else fight the flow |
 |
|
|
anjan
Starting Member
21 Posts |
Posted - 2005-09-25 : 13:31:11
|
| but i'm not using just first(column) in select statment .i'm using along with other fields in the select statement.some fields are having aggregate functrion (sum).e.gselect f1,f2,sum(f3),f4from t1group by f1,f2now i want to dislay only first value from f4 |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2005-09-25 : 14:10:05
|
select f1,f2,sum(f3),min(f4)from t1group by f1,f2Go with the flow & have fun! Else fight the flow |
 |
|
|
anjan
Starting Member
21 Posts |
Posted - 2005-09-29 : 00:34:26
|
| thanks for replying....but...here my f4 field is integer...if i write select f1,f2,f3,min(f4) from table group by f1,f2,f3i'll get min of f4 of the group,but i want only the first value whatever it is min or max |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-09-29 : 00:50:43
|
| I think you need to use subquery which select top 1 columnPost some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|
|
|