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 |
|
pappandin
Starting Member
9 Posts |
Posted - 2011-11-08 : 03:12:26
|
| I was using this:SELECT temperatur as maxtemp, dato as maxtempdatoFROM `observasjoner`WHERE temperatur=(select max(temperatur) from observasjoner) and DATE_FORMAT(dato, '%v-%x') = colnameto show the max temperature ( its in norwegian, but you understand it).But if i change the MAX to MIN the output is nothing.Any ideas?If I use MAX the output is like this12 2011-10-19but if I use MIN nothing will show |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-08 : 03:20:38
|
| is this sql server? DATE_FORMAT is not a function available in sql server. i think you're using MySQL------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
pappandin
Starting Member
9 Posts |
Posted - 2011-11-08 : 03:24:07
|
| I can do it by making smaller and less complicated sql-commands, but it would've been better if i had one recordset; for the tidyness |
 |
|
|
pappandin
Starting Member
9 Posts |
Posted - 2011-11-08 : 03:29:54
|
| I'm sorry, im using MySQL at this moment yes, but do you know any similar function? Just downloaded Mysql, thought they used the same functions. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-08 : 03:36:00
|
quote: Originally posted by pappandin I'm sorry, im using MySQL at this moment yes, but do you know any similar function? Just downloaded Mysql, thought they used the same functions.
similar function for what?Your question is not clearwhats it that you're trying to solve?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
pappandin
Starting Member
9 Posts |
Posted - 2011-11-08 : 03:40:12
|
| I want to show the min. temperature from a weekDATE_FORMAT(dato, '%v-%x') is the function in MySQL, is there a similar one on SQL? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-11-08 : 03:48:33
|
quote: Originally posted by pappandin I want to show the min. temperature from a weekDATE_FORMAT(dato, '%v-%x') is the function in MySQL, is there a similar one on SQL?
yep...there's CONVERTbut formatting shouldbe done only at front end. no need to do this in t-sql query------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|
|
|