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 |
|
Gaberiele
Starting Member
3 Posts |
Posted - 2007-10-10 : 07:04:42
|
| My table is this:id_voto int key;pulizia intaccoglienza intcondizioni intconfort intthe query is:SELECT avg( pulizia & accoglienza & condizioni & confort ) FROM votazioniWHERE id_voto =10 they do not give to error but not even the average correct!Which it is the problem? Thanks! |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-10 : 07:06:40
|
SELECT avg( pulizia + accoglienza + condizioni + confort ) FROM votazioniWHERE id_voto =10 SELECT avg( pulizia ), avg( accoglienza ), avg( condizioni ), avg( confort ) FROM votazioniWHERE id_voto =10 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
Gaberiele
Starting Member
3 Posts |
Posted - 2007-10-10 : 07:15:46
|
| the first too much give an elevated number to me the second give the value of pulizia,....: 4 6 6 7 |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-10-10 : 07:30:50
|
SELECT ( pulizia + accoglienza + condizioni + confort ) / 4.0FROM votazioniWHERE id_voto = 10 E 12°55'05.25"N 56°04'39.16" |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-10-10 : 07:37:46
|
| Make sure you handle NULLsMadhivananFailing to plan is Planning to fail |
 |
|
|
Gaberiele
Starting Member
3 Posts |
Posted - 2007-10-10 : 10:16:35
|
quote: Originally posted by Peso SELECT ( pulizia + accoglienza + condizioni + confort ) / 4.0FROM votazioniWHERE id_voto = 10
this is the solution!thanks! |
 |
|
|
|
|
|