Calculations in a query

Neil_Pattison

Registered User.
Local time
Today, 14:53
Joined
Aug 24, 2005
Messages
73
Hi, firstly I just want to put I'm a beginner in SQL so don't laugh too loud when you read this.

I have a query that takes two field sfrom seperate tables. Lets call the fields X and Y.

The X field contains an ID number (there are 6 possible instances) which can be duplicated many times. The Y field holds individual pieces of data(sample data below)


........X....................................Y

......1202..............................ABCDE
......1202..............................FJDUS
......1202..............................HFDYH
......1402..............................JHFJGF
......1402..............................GHDDF
......1506..............................FVHJFG
......1609..............................JHFHGF
......1609..............................JJVVJHV
......1609..............................BJHHGG
......1609..............................VJXGGJ
......1609..............................VJXGJKH

I need to be able to find out how many instances of Y occur for each ID number in the X field so the query would show something like

..........X.............................Total

.......1202..............................3
.......1402..............................2
.......1506..............................1
.......1609..............................5

Once you have stopped laughing can you please let me know what criteria I need to put in to carry this out, thanks
 

Users who are viewing this thread

Back
Top Bottom