I have a table which contains two columns, one called Dealers, one called Brands. Any entry in the table represents a dealer stocking a given brand.
What I'm trying to get is a SQL query that allows be to list each dealer that stocks all of a given selection of brands, rather than just returning each dealer that stocks at least one of the aforementioned brands. Anyone got any ideas?
_________________ "The woman is a riddle inside a mystery wrapped in an enigma I've had sex with."
Group by the dealer, return where each item in the subset is there
as a c# linq statement (may need some tweaking)
string[] brands = new string[]{"foo","bar"}; var foo = from t in table group t by t.Dealer into tDeal where(t.select(p=>p.Brands).Intersect(brands));
_________________ Twitter Charlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
Am I being thick here or isn't the query just select dealer where brand = abc and def and etc?
it is, but as (possibly) a more programmatic approach
_________________ Twitter Charlie Brooker: Macs are glorified Fisher-Price activity centres for adults; computers for scaredy cats too nervous to learn how proper computers work; computers for people who earnestly believe in feng shui.
Users browsing this forum: No registered users and 3 guests
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum