error on percentage calculation

Posted by Shijohnjoseph under Sql Server on 6/1/2011 | Points: 10 | Views : 1495 | Status : [Member] | Replies : 4
Hi,
i have to calculate percentage of one value field with another value field as percentage ,
i cann't use a where field in my query how it might be possible
this is my query
select((SELECT CAST(SplTariff_amount as float) FROM Hotel_SpecialTariff )+((SELECT CAST(SplTariff_amount as float) FROM Hotel_SpecialTariff)/100*(SELECT CAST(SplTariff_Tax AS float) FROM Hotel_SpecialTariff )))


"Personality has the power to open many doors, but character must keep them open"


Responses

Posted by: Vuyiswamb on: 7/6/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Your Query is not Correct
it confuses you because it is not structured. Add some values to variables so that it will be easy for you to debug it. you have too many from's and some from match a Select and you try to calculate from the tables name



Thank you for posting at Dotnetfunda
[Administrator]

Shijohnjoseph, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: PandianS on: 7/6/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi

Can you please tell me what is the Err ?

Cheers

Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

Shijohnjoseph, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RaviRanjanKr on: 7/13/2011 [Member] Starter | Points: 25

Up
0
Down
hey! its not clear if possibly try to include your Table Snaps I means its whole Structure. and as PandianS says include error also what you getting while executing.
I Hope you will come again with specific question.

Thanks
Ravi Ranjan Kumar
http://raviranjankr.wordpress.com

Shijohnjoseph, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Kunalverma31 on: 8/16/2011 [Member] Starter | Points: 25

Up
0
Down

Declare @Tem1 float
Declare @Tem2 float
Declare @Tem3 float


SELECT @Tem1=CAST(SplTariff_amount as float) FROM Hotel_SpecialTariff
SELECT @Tem2=CAST(SplTariff_amount as float) FROM Hotel_SpecialTariff
SELECT @Tem3=CAST(SplTariff_Tax AS float) FROM Hotel_SpecialTariff

Select ((@Tem1+ @Tem2)/@Tem3)*100

Shijohnjoseph, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response