COUNT()

Jun 19, 2007 2 Replies

I am looking for the code to count unique numbers. There will be a list of transaction numbers, I need to be able to count the ones that have different numbers


Hi Tommyvcfs - you could try

select count(*) from [transaction]

This will show you the number of rows (records) on your transaction table. Each row is a different transaction where transaction number is the primary key

H> I am looking for the code to count unique numbers. There will be a list of

that works in the RMS database because the [transaction] table has a unique transactionNumber by definition.

To get a count of unique values in a column where the values can repeat (Item.DepartmentID for example) use this: select count(distinct departmentID) from Item

Or to find out how many occurances of each value there are:

select departmentID, count(*) from item group by departmentID

Glenn Adams Tiber Creek C> Hi Tommyvcfs - you could try

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required