dbTalk Databases Forums  

Data in classes

comp.databases.ms-access comp.databases.ms-access


Discuss Data in classes in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
regrat
 
Posts: n/a

Default Data in classes - 03-09-2009 , 05:18 PM






I need a query grouping some data in classes. E.g.:

Having this data
______________
gendre | tall
M | 1.78
F | 1.67
M | 1.75
M | 1.72
F | 1.74
F | 1.57
M | 1.68
F | 1.76
M | 1.90
_______________

make a classes-schema like this:
__________________________________
gendre | tall classes | count(gendre)
F |da 1,60 a 1,70 | 1
F | da 1,70 a 1,80 | 3
M | da 1,60 a 1,70 | 1
M | da 1,70 a 1,80 | 3
M | da 1,80 a 1,90 | 1
_________________________________

it is possible? Thanks!

Reply With Quote
  #2  
Old   
Builder
 
Posts: n/a

Default Re: Data in classes - 03-09-2009 , 07:30 PM






regrat wrote:
Quote:
I need a query grouping some data in classes. E.g.:

Having this data
______________
gendre | tall
M | 1.78
F | 1.67
M | 1.75
M | 1.72
F | 1.74
F | 1.57
M | 1.68
F | 1.76
M | 1.90
_______________

make a classes-schema like this:
__________________________________
gendre | tall classes | count(gendre)
F |da 1,60 a 1,70 | 1
F | da 1,70 a 1,80 | 3
M | da 1,60 a 1,70 | 1
M | da 1,70 a 1,80 | 3
M | da 1,80 a 1,90 | 1
_________________________________

it is possible? Thanks!

Excuse me while I Americanize it and fix your spelling and use 'Height'
instead of Tall

SELECT
Gender,
IIf(Height > 1.5 AND Height <= 1.7, '1.5 to 1.7',
IIf(Height >= 1.71 AND Height <= 1.75, '1.71 to 1.75',
IIf(Height > 1.75, 'Above 1.75'))) as HeightGroup,
Count(Height) AS Count

FROM
Table1

GROUP BY
Gender,
IIf(Height > 1.5 AND Height <= 1.7, '1.5 to 1.7',
IIf(Height >= 1.71 AND Height <= 1.75, '1.71 to 1.75',
IIf(Height > 1.75, 'Above 1.75'))) ;


It would be better (more configurable/maintable) for you to have a separate
table containing the height groupings.





Reply With Quote
Reply




Thread Tools
Display Modes

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

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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.