Basically I have a table on my server that is a mirror of another table minus some rows I don't care about. I'm trying to use the number of rows and the max ID to determine what percentage of rows were skipped when copying the table.
I've never done math in a SQL query before, and it's probably something simple I'm missing.
Here is my query:
SELECT
count(*) As Processed,
MAX(ID) - count(*) As Ignored,
MAX(ID) as Total,
(MAX(ID) - count(*)) / MAX(ID) as PercentIgnored
FROM Table
Here are the results
Processed Ignored Total PercentIgnored
6213074 8462494 14675568 0
If I manually calculate 8462494/14675568 it's obviously not zero. More like 57%.