Click to See Complete Forum and Search --> : sql top urgent


hussein2000
May 6th, 2006, 09:15 AM
hello friend

can i use function within another function in sql statement


ex:

i have two column in the table just like

s_name Nationality

a usa
b usa
c uk
d india
e uk
f uk
g usa
h japan
i india
j japan
k uk
l india
m usa
n japan
o india
p japan
q usa
r japan



here i want to display the nationality , nationality number and percentage of each nationality from the total of all nationality





i use this statement but not work

SELECT nationality,count(Nationality) AS Nat, sum(count(Nationality)) AS FROM Country
group by Nationality;


so pleas help to get correct answer

thanks

hussein2000
May 7th, 2006, 03:16 AM
hello what's up

where have u been brothers i am wating for your reply


thanks

HairyMonkeyMan
May 7th, 2006, 06:48 AM
Hi..

I don't really understand your problem....

Although, I can't see your reason for doing the following: sum(count(Nationality)

If that even works..... it will be adding up the record count... so if you have 3 records, the answer would be: 1 + 2 + 3 = 6

I'm not sure if you can embed sql functions like that.... maybe someone else knows..

Good luck