Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 SQL 2000 Help - two tables and how to get count f

Author  Topic 

jwalker67
Starting Member

1 Post

Posted - 2007-09-23 : 18:22:24
First things first... I HAVE LITTLE TO NO DB KNOWLEDGE so I am looking for complete help and not code snippets. PLEASE.

I have a table that contains categories with CategoryName, CategoryID, TotalCount, Working and NotWorking columns.

The second table has the items that belong to the Category table with a working column. The working column is true or false.

What I need to do:
Get a count of all the items that belong to given Category
Get a count of items for given Category that are "working"
Get a count of items for given Category that are "not working"

I need to know how I can update the related fields in the Category table when a new item is added or when an item is updated...ie changed from working to not working or vice versa.

I need this information in the table as I am then querying the tables to build a nested table display that displays the Category as the header with all the "roll-up" information and then the item info.

I think what I need is some kind of trigger or stored procedure that is called with each insert or update of the 2nd table, but I am not sure and more importantly....I don't know how.

I hope this makes sense and that someone can help.

ALL HELP is greatly appreciated.

nr
SQLTeam MVY

12543 Posts

Posted - 2007-09-23 : 20:15:47
>> I am looking for complete help and not code snippets.
So you don't want to learn - you want someone to do it for you?
I am happy to give consultancy support - what rate can you offer?
It looks fairly trivial but would need to know more to give th ebest solution.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -