![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi there, Here is another SQL related problem. I have an application that performs frequent searches. One of the requirements is that it should bring back an exact number of entities being searched no matter how many describing rows there could be. So for example: say you are searching for customers and displaying customer orders. Since customers could have many orders doing SELECT TOP 100 would return not 100 customers but one hundred orders. I see numerous alternatives here: one, perform one SELECT that returns customers and then perform 100 SELECTs to return order for each customer. Two, include a join in the search SQL to a subquery that looks something like this: |
#3
| |||
| |||
|
|
Do you have to bring back all of the orders for the 100 customers? Or could you, instead, bring back the most recent order for each of the 100 customers and then provide drilldown funcationality to see other associated orders? "Bob" <boblotz2001 (AT) yahoo (DOT) com> wrote in message news:77f25a90.0407220542.62daff3d (AT) posting (DOT) google.com... Hi there, Here is another SQL related problem. I have an application that performs frequent searches. One of the requirements is that it should bring back an exact number of entities being searched no matter how many describing rows there could be. So for example: say you are searching for customers and displaying customer orders. Since customers could have many orders doing SELECT TOP 100 would return not 100 customers but one hundred orders. I see numerous alternatives here: one, perform one SELECT that returns customers and then perform 100 SELECTs to return order for each customer. Two, include a join in the search SQL to a subquery that looks something like this: |
#4
| |||
| |||
|
|
Actually I have to bring all the orders for all the customers. That's the root of the problem. Thanks Bob "Adam Machanic" <amachanic (AT) hotmail (DOT) _removetoemail_.com> wrote Do you have to bring back all of the orders for the 100 customers? Or could you, instead, bring back the most recent order for each of the 100 customers and then provide drilldown funcationality to see other associated orders? "Bob" <boblotz2001 (AT) yahoo (DOT) com> wrote in message news:77f25a90.0407220542.62daff3d (AT) posting (DOT) google.com... Hi there, Here is another SQL related problem. I have an application that performs frequent searches. One of the requirements is that it should bring back an exact number of entities being searched no matter how many describing rows there could be. So for example: say you are searching for customers and displaying customer orders. Since customers could have many orders doing SELECT TOP 100 would return not 100 customers but one hundred orders. I see numerous alternatives here: one, perform one SELECT that returns customers and then perform 100 SELECTs to return order for each customer. Two, include a join in the search SQL to a subquery that looks something like this: |
![]() |
| Thread Tools | |
| Display Modes | |
| |