Hi <#C0FHNQ2N6|windows> I am trying to run a query...
# windows
w
Hi #windows I am trying to run a query that can check the status of all columns in the windows_security_center_services table. I build the following query, but I am wondering if there is a more optimal way to do it, since the status I am trying to check is the same, so I can avoid repetition. The status for all services should be "Good".
*SELECT* firewall, autoupdate, antivirus, antispyware, internet_settings, windows_security_center_service, user_account_control *FROM* windows_security_center *WHERE* firewall *LIKE 'Good' AND* autoupdate *LIKE 'Good' AND* antivirus *LIKE 'Good' AND* antispyware *LIKE 'Good' AND* internet_settings *LIKE 'Good' AND* windows_security_center_service *LIKE 'Good' AND* user_account_control *LIKE 'Good';*
z
This query will only return results if all the services are in
Good
state. Is that intentional? I would think you probably want just
SELECT firewall, autoupdate, antivirus, antispyware, internet_settings, windows_security_center_service, user_account_control FROM windows_security_center
.
s
And if you want all columns, just
SELECT * from windows_security_center
w
Hi @zwass Yes. The idea is to return the status only if it is good.
z
In that case I'd probably do something like
SELECT 'Good' AS windows_security_center_status FROM windows_security_center WHERE firewall = 'Good' AND autoupdate = 'Good' AND antivirus = 'Good' AND antispyware = 'Good' AND internet_settings = 'Good' AND windows_security_center_service = 'Good' AND user_account_control = 'Good';
👍 1
w
Thank you guys. much appreciated.