New to SQL - Need Some Help Please :)
Hi, I am using the following SQL to find out a list of stores that have a manager in place, and include a blank for those that don't. The following has had some success however I am confused and need some help tweaking.
- On lots of forums i've seen the alias being used - I can't get it to - how would I create an alias to simplify the below SQL?
- Not sure if byproduct of Question1 but the below doesn't want to work if I dont use " around the tables or columns - any thoughts?
- The table "Active Managers" is a query table of its own basically filtering a list of Stores, and their structure where a manager is on record - HOWEVER - its getting its data from the Training Results table in the first place. Seems a bit long winded to filter data out, in an unused query table to bring it back again for this. - Any ideas on merging or incoporating?
I'm basically filtering the training results to just show the Store ID and Region/Area info where there is a role of Manager
select DISTINCT "Training Results"."STOREID", "Training Results"."REGION_MANAGER","Training Results"."AREA_MANAGER","Active Managers"."JOB_ROLE"
from "Training Results" LEFT join "Active Managers"
on "Training Results"."STOREID" = "Active Managers"."STOREID"
ORDER BY "STOREID"
Any help is much appreciated :)