Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
MSDE/SQL Server/etc - Stored procedures and such
Message
From
16/08/2003 12:54:22
 
 
To
16/08/2003 12:47:46
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00820729
Message ID:
00820789
Views:
21
Thanks BOb (and all others too) for these lessons.

So if I've got a basic grasp of the situation it looks like Stored Procedures should be "welcomed" by most SQL Administrators, but I have other alternatives that should all be workable (minor re-writes required) though less efficient.

cheers

>>I understand that SQL Server allows that, but what I'm missing (I think) is... from one SELECT to the next, how does SQL Server know to keep the prior results around for later use IF I have sent the SELECTs each independently to it (as looks like would be the case with my present code)?
>>
>
>
>Because a dervied table is just part of the query... For example, lets say you have:
>
>VFP:
>
>SELECT sum(sales), salesman_id
>FROM sales
>GROUP BY salesman_id
>IN CURSOR salesamount
>
>SELECT *
>FROM salesmen s
>JOIN salesamount a ON s.salesman_id = a.salesman_id
>ORDER by s.lastname
>
>********************
>In sql server, you can use the first select as a derived table in the second select. So, the single select statement would be:
>
>SELECT *
>FROM salesmen s
>JOIN (
> SELECT sum(sales), salesman_id
> FROM sales
> GROUP BY salesman_id
> ) a ON s.salesman_id = a.salesman_id
>
>
>**********
>BOb
Previous
Reply
Map
View

Click here to load this message in the networking platform