I am trying to perform a unique lookup using these two tables:
assessments
asmtID | scaleID
----------------------
2 | 1
2 | 3
2 | 4
scales
scaleID | custID | Name
-------------------------------
1 | 0 | test1
3 | 0 | test2
3 | 1 | custom
4 | 0 | test3
I want to select one record for each of the scale records that has a match in the assessments table, but I want the record with the custID =1 (if it exist) or otherwise the record with custID = 0
I've gotten myself stuck on this one for awhile now and would love it if someone has a query that can solve.
Thanks