SQL hmmm

Qwerty8989

Registered User.
Local time
Today, 03:16
Joined
Oct 17, 2006
Messages
11
Hi,

I am trying to show the supplier which sells all species of plants:

SELECT LEVERANC.LEV_NAAM, PLANTEN.SOORT
FROM PLANTEN INNER JOIN (LEVERANC INNER JOIN OFFERTES ON LEVERANC.LEV_CODE = OFFERTES.LEV_CODE) ON PLANTEN.ART_CODE = OFFERTES.ART_CO;

This will bring up all suppliers and every species of plant they sell. I am unsure about the best way to proceed. Would a count work or is a subselect needed? :s

Thanks!
 
sorry, i can't do this with sql

get a query in the query designer which joins the suppliers to the plants they supply, so you only have supplier id, and plant id. if you may have multiple instances of this combination, select unique values in the query properties. Turn that into a totals query, and COUNT the supplierids.

so you are looking for suppliers in this table where the COUNT is equal to the number of records in the plant table - because clearly they supply every plant.

hope this works ok
 

Users who are viewing this thread

Back
Top Bottom