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 |
|
peteoc
Starting Member
14 Posts |
Posted - 2008-01-21 : 06:15:15
|
| I'm getting confused with how to perform a query. Maybe someone can help :)I have a table with the following fields:id - intname - varchar(255)value - intdate - datetimeAs an example I have the following data in this table1,cooker,1,21 jan 2008 11:00:002,cooker,1,21 jan 2008 12:00:003,temp,300,21 jan 2008 11:00:004,temp,450,21 jan 2008 12:00:005,cooker,0,21 jan 2008 14:00:006,temp,16,21 jan 2008 15:00:00I would like to be able to get the min value of temp while cooker = 1. I'm confused as to how to go about this, I have tried creating a view but I'm stuck :(thanks in advance!! |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-01-21 : 06:22:24
|
Something similar toSELECT Col1, Col2FROM (SELECT Col1, Col2, ROW_NUMBER() OVER (PARTITION BY Col3 ORDER BY Col4 DESC) AS RecIDFROM Table1 WHERE Col5 IS NULL) AS dWHERE RecID = 1 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
|
|
|
|
|