Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Brain Freeze? or is it possible
Message
From
12/01/2016 16:51:31
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Brain Freeze? or is it possible
Miscellaneous
Thread ID:
01629732
Message ID:
01629732
Views:
74
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.
Next
Reply
Map
View

Click here to load this message in the networking platform