Title
#windows
William Guilherme

William Guilherme

10/05/2020, 9:12 PM
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';*
zwass

zwass

10/05/2020, 9:22 PM
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
.
sundsta

sundsta

10/05/2020, 9:30 PM
And if you want all columns, just
SELECT * from windows_security_center
William Guilherme

William Guilherme

10/05/2020, 9:30 PM
Hi @zwass Yes. The idea is to return the status only if it is good.
zwass

zwass

10/05/2020, 9:39 PM
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';
William Guilherme

William Guilherme

10/05/2020, 11:16 PM
Thank you guys. much appreciated.