I have this query which works fine.
I need the rows where the subcategory belongs to the company
OR
The company has access to default subcategories (c.plannerdefaults =1 )and the subcategory is a default subcategory (s.company =0)
SELECT distinct
s.category from planner_subcat s, company c
where
(
c.id = 66
and c.plannerdefaults = 1
and s.company = 0
)
or s.company = 66
The thing is, and maybe my thinking is wrong here, I got the impression that if a query starts with
select col from table1, table2
then there is something wrong with the methodology, but in this case I could not think of an alternative using a join.
Is there one?