Calgarypuck Forums - The Unofficial Calgary Flames Fan Community

Go Back   Calgarypuck Forums - The Unofficial Calgary Flames Fan Community > Main Forums > The Off Topic Forum
Register Forum Rules FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Search this Thread
Old 01-13-2006, 10:50 AM   #1
Calgary Flames
Lifetime Suspension
 
Join Date: Oct 2001
Location: Calgary, AB
Exp:
Default Sql Help!!

How do I write a sql statement that would add up the population of "Men" and "Women" from the table called "Calgary" in SQL?

Help a brother out!
Calgary Flames is offline   Reply With Quote
Old 01-13-2006, 11:15 AM   #2
arsenal
Director of the HFBI
 
arsenal's Avatar
 
Join Date: Sep 2004
Location: Calgary
Exp:
Default

I think you may want an nvl in that query as well.
arsenal is offline   Reply With Quote
Old 01-13-2006, 12:01 PM   #3
Bobblehead
Franchise Player
 
Bobblehead's Avatar
 
Join Date: Jul 2005
Location: in your blind spot.
Exp:
Default

How is the data stored in the table?
Bobblehead is offline   Reply With Quote
Old 01-13-2006, 01:05 PM   #4
arsenal
Director of the HFBI
 
arsenal's Avatar
 
Join Date: Sep 2004
Location: Calgary
Exp:
Default

Quote:
Originally Posted by fotze
I dunno, I've never programmed in SQL, I was seeing what access would show me if a viewed a query in SQL.
Depends.. could be close, but Access probably gives you MSSQL, which has a little different syntax that Oracle.

probably something along the lines of:
Code:
select sum(nvl(count(men)) + nvl(count(woman))) from calgary
arsenal is offline   Reply With Quote
Old 01-13-2006, 01:31 PM   #5
Calgary Flames
Lifetime Suspension
 
Join Date: Oct 2001
Location: Calgary, AB
Exp:
Default

Gah, you were all too late, and fotze. that didn't work... at all. arsenal is closest it has something to do with Sum, btw this was Oracle9i SQL stuff.

thanks though
Calgary Flames is offline   Reply With Quote
Old 01-13-2006, 02:00 PM   #6
Bobblehead
Franchise Player
 
Bobblehead's Avatar
 
Join Date: Jul 2005
Location: in your blind spot.
Exp:
Default

You needed to tell me what your data looked like (I'm an oracle DBA)

The NVL needs another argument

NVL(field, 'whatever you want it to be if field is null')
Bobblehead is offline   Reply With Quote
Old 01-13-2006, 02:02 PM   #7
Calgary Flames
Lifetime Suspension
 
Join Date: Oct 2001
Location: Calgary, AB
Exp:
Default

I needed to add up the population of Men and Women columns in the table "Calgary" Seperately, How many men there are total and how many women.
Calgary Flames is offline   Reply With Quote
Old 01-13-2006, 03:07 PM   #8
arsenal
Director of the HFBI
 
arsenal's Avatar
 
Join Date: Sep 2004
Location: Calgary
Exp:
Default

Quote:
Originally Posted by Bobblehead
You needed to tell me what your data looked like (I'm an oracle DBA)

The NVL needs another argument

NVL(field, 'whatever you want it to be if field is null')
oops, forgot about that.

But yah, in order to help, need to know how the data is structured in the table.
arsenal is offline   Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 01:06 PM.

Calgary Flames
2024-25




Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright Calgarypuck 2021 | See Our Privacy Policy