By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,510 Members | 1,821 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,510 IT Pros & Developers. It's quick & easy.

Sum and Insert Query Question

P: n/a
Hi,

I am trying to write a query that counts up the number of accounts a
user is assigned, and then inserts this count into another table.

The table layout is as follows:

tbl_Users:
UserID, Count

tbl_Accounts:
Service1, Service1AssignedUser, Service2, Service2AssignedUser,
Service3, Service3AssignedUser, Service4, Service4AssignedUser,
Service5, Service5AssignedUser, Service6, Service6AssignedUser

So, for each user, I need a sum of the number of "services" they are
currently assigned and need that inserted into the count in tbl_Users.

Note: A user can be assigned multiple services for one record, and
these should all be counted (aka a user can have up to 6 "services"
per record)

Any help you could provide would be great,

Sean
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
se**********@alum.rpi.edu (Sean) wrote in
news:38**************************@posting.google.c om:
Hi,

I am trying to write a query that counts up the number of
accounts a user is assigned, and then inserts this count into
another table.

The table layout is as follows:

tbl_Users:
UserID, Count

tbl_Accounts:
Service1, Service1AssignedUser, Service2,
Service2AssignedUser, Service3, Service3AssignedUser,
Service4, Service4AssignedUser, Service5,
Service5AssignedUser, Service6, Service6AssignedUser

So, for each user, I need a sum of the number of "services"
they are currently assigned and need that inserted into the
count in tbl_Users.

Note: A user can be assigned multiple services for one record,
and these should all be counted (aka a user can have up to 6
"services" per record)

Any help you could provide would be great,

Sean

Redesign your sructure tbl_Accounts
you should have only one service per record.
--
Bob Quintal

PA is y I've altered my email address.
Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.