Svgmassive
asked on
count all and uniques records in a table
I have imported 128591 records from an old database>What is the best approach to get the total and unique record count.I have been getting system resources exceeded errors
thanks
thanks
You can use:
/gustav
Select Count(*) From
(Select Distinct Field1, Field2, Field3, ..., Fieldn From YourTable) As T
where you include the fields that should be unique. Exclude Memo fields./gustav
ASKER
I have using both suggestions in a union query just cant understand the system resources issues
post the SQL statement what you are using to get the unique count
A union query? You neither mentioned that, nor need such one.
Or try with not "Union Select ..." but "Union All Select ..."
/gustav
Or try with not "Union Select ..." but "Union All Select ..."
/gustav
Define "unique". Create a new table with an autonumber primary key and a unique index to prevent logical duplicates from being added. Create an append query to copy the imported records to the new table. Only the first instance of a "duplicate" will be added. The rest will be discarded.
ASKER
this is what i am using that's giving me the system resource error
SELECT DISTINCT Count(t.Sequencenumber) AS CountOfSequencenumber
FROM (SELECT DISTINCT Sequencenumber FROM New_Results_list) AS t
HAVING (((Count(t.Sequencenumber) ) Is Not Null));
UNION SELECT Count(*) AS CountOfsequencenumber
FROM New_Results_list
WHERE (((New_Results_list.sequen cenumber) Is Not Null));
SELECT DISTINCT Count(t.Sequencenumber) AS CountOfSequencenumber
FROM (SELECT DISTINCT Sequencenumber FROM New_Results_list) AS t
HAVING (((Count(t.Sequencenumber)
UNION SELECT Count(*) AS CountOfsequencenumber
FROM New_Results_list
WHERE (((New_Results_list.sequen
try this, copy and paste then run. see if it gives you what you want
select Sequencenumber, Count(Sequencenumber) as CountOfSequencenumber
from New_Results_list
where Sequencenumber is not null
group by Sequencenumber
union
select 'Total Count', count((*) as CountOfSequencenumber
from New_Results_list
where Sequencenumber is not null
select Sequencenumber, Count(Sequencenumber) as CountOfSequencenumber
from New_Results_list
where Sequencenumber is not null
group by Sequencenumber
union
select 'Total Count', count((*) as CountOfSequencenumber
from New_Results_list
where Sequencenumber is not null
ASKER
syntax errors
oops, too many "("
select Sequencenumber, Count(Sequencenumber) as CountOfSequencenumber
from New_Results_list
where Sequencenumber is not null
group by Sequencenumber
union
select 'Total Count', count(*) as CountOfSequencenumber
from New_Results_list
where Sequencenumber is not null
select Sequencenumber, Count(Sequencenumber) as CountOfSequencenumber
from New_Results_list
where Sequencenumber is not null
group by Sequencenumber
union
select 'Total Count', count(*) as CountOfSequencenumber
from New_Results_list
where Sequencenumber is not null
ASKER
it's not giving me the desired results
ok now post sample values and post desired result. use an excel file for the sample and desired result and upload here.
ASKER
CountOfSequencenumber
44089
128591
44089
128591
ASKER
one is a distinct value the other is the regular count
post the result returned by the query I posted?
ASKER
Sequencenumber CountOfSequencenumber
it has 44090 records
Total Count 128591
it has 44090 records
Total Count 128591
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
so, what is the result?
ASKER
that's it Rey,I will try to see if i get the system resource error message
Thanks
Thanks
select IdField, count(idField)
from TableX
group by IdField