mysql - FInd the names of customers are interested in every artist -
i looking customer names of customers have interest in artists.
i understand in relational algebra, can use division operator, not understand sql format in doing so.
i have these tables columns:
customer (customerid, firstname, lastname) artist (artistid) customer_interest_in_artists (artistid, customerid)
how go doing this?
you using simple min()
construct:
select c.firstname, c.lastname, min(ci.customerid not null) interest_all artist left join customer_interest_in_artists ci using (artistid) left join customer c using (customerid) group c.customerid having interest_all = 1
Comments
Post a Comment