I have a problem with a query:
I have a list of stores, each of these stores has members and there are various categories of membership (Bronze, silver, gold …)
The tables are: ‘shops’, ‘members’, ‘membership_cards’.
shops: id, name
members: id, shops_id, membership_id, first_name, last_name
membership_cards: id, description
I need to extract the count of members, grouped by membership of each stores. Can I do this without using a server side language?
The final result should be something like:
Store’s name, n°bronze members, n°silver_members, n°gold_members ….
Based on what you provided, you want a query like:
If you want to know the number of members, rather than of cards in each group (if members can have more than one card), then replace the sum() expression with: