Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
This should be easy but...
Message
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
00502830
Message ID:
00503137
Vues:
27
select vdr.vendorID from Vendor vdr where vdr.state in 
   (select vdr1.state from vendor vdr1 group by state having count(state)>1)
>Actually, single table with:
>
>TABLE: VENDOR
>-------------
>VendorID
>Vendorname
>Address
>City
>State
>Zip
>etc...
>
>I want to retrieve all VendorID primary key where there are more than one vendor in any state.
>
>
>>You want the ID of all vendors who service multiple states?
>>
>>Assuming two tables: vendors and VendorsInStates
>>
>>SELECT VendorID
>>FROM VendorInStates
>>GROUP BY VendorID
>>HAVING COUNT(*) > 1
>>
>>If this isn't close, post the DDL.
>>
>>-Mike
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform