I have several tables all of which have the column LOCQUALITY. There are about 10 different values for LOCQUALITY. I want to know the percentage of the LOCQUALITY field from all the tables combined. I have been using these two queries:
Select LOCQUALITY, (Count(LOCQUALITY)* 100 / (Select Count(*) From TSDBA.TS_LOCATION))
From TSDBA.TS_LOCATION
Group By LOCQUALITY
This one gets the percentage of just one table. I go it from here How to calculate percentage with a SQL statement
And I used this one to determine which are the tables that have the LOCQUALITY column (It returned like 30 tables). Got it from here Find all tables containing column with specified name
SELECT COLUMN_NAME, TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME LIKE '%LOCQUALITY%'
I want to combine these two but I have only gotten errors. Thanks for your help