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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 problem with count

Author  Topic 

ibn-al-haytam
Starting Member

5 Posts

Posted - 2010-10-01 : 17:34:23
hi
please help in this
i have probleme with count and i wont help please
i have three table :flight ,flight details and airplane
flight and flightdetails are joined based on their flightID,flight and airplane are joined based on their airplaneID
I want a list that displays the average load
of aircraft
i wrote the folowing query :
select avion.av#,avion.capacite,vol.vol#,
convert(decimal(2,0),count(affectevol.passager)/avion.capacite*100)+'%'as'taux du remplissage moyen'
from affectevol join vol on affectevol.vol=vol.vol#
join avion on vol.avion=avion.av#
group by avion.av#,vol.vol#
the compiler did not accepte it

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-10-01 : 17:41:31
It compiles okay on my SQL Server 2005 system and SQL Server 2008 R2 system.

What are you using?

And please post the exact error.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-10-02 : 02:56:06
one thing i found is you're trying to concatenate string to decimal field. so you might have cast the decimal value to varchar before doing that. But question why you want to change the datatype for showing %? its a presentation issue and should be dealt at the front end

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -