Skip to content
Advertisement

MYSQL Query calculate percentage of emails not null

I have these two queries. Caluculates count of emails that are null SELECT COUNT(*) as invalid_email FROM distinct_customers WHERE c_email IS NULL; Calculates count of every email SELECT COUNT(distinct c_number) as total FROM distinct_customers; I am trying to combine those to queries so that it gives me a percentage of valid emails (not null) I tried a couple of ways

Group by question in SQL Server, migration from MySQL

Failed finding a solution to my problem, would love your help. ~~ Post has been edited to have only one question ~~- Group by one query while selecting multiple columns. In MySQL you can simply group by whatever you want, and it will still select all of them, so if for example I wanted to select the newest 100 transactions,

SQL join table with 12 column composite PK with itself painlessly

I have a table with a composite natural primary key that involves 12 columns (c1, c2, …, c12). I want to write a self join query: This join is a pain to write. Is there a better way? Answer Personally, if you must have a 12 column “key”, I would DROP that key, and create a computed column that concatenates

Need to Update based on ID and Date

I have the following SQL statement, which I think should update 1 field, using some pretty simple standard deviation logic, and based on ID and Date. I think the ID and Date has to be included to get …

Advertisement