I have a custom product grid not associated with Craft Commerce. I am wondering, how can I query, in the SQL database, all entries and their related categories?
1 Answer
The relations
table holds all of the information about relations between Craft elements (entries and categories in your case).
So you would use the sourceId
and targetId
columns of the relations
table and join on the id
columns of the entries
and categories
tables in your example.