Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Brain Freeze? or is it possible
Message
De
12/01/2016 16:51:31
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Brain Freeze? or is it possible
Divers
Thread ID:
01629732
Message ID:
01629732
Vues:
73
SELECT * FROM depdetail WHERE  postingdate = '2016-01-07' AND LEFT(store,4) =  @comp_code
This works.

There's another table called company.
The company table has a column called comp_group, which can be blank or contain the code of another row in the table (comp_code)

It's a way of grouping related companies for reporting.

In addition to the rows pulled above, I'd like the query to pull any rows of related companies.

I can do it in the .NET app by looping, but I'd like to do it with a query if possible.

Any ideas?
Anyone who does not go overboard- deserves to.
Malcolm Forbes, Sr.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform