Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Alternating results based on a single column

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-11-05 : 22:39:28
Itai writes "Hi Guys,

Visiting here for the first time...great site...keep up the good work.

Now let's get down to business.
I have 10 tables with identical structure in the database. Each table holds product information from a different supplier (product name, price, description, etc..)
What I need to do is let users search all the data and display the aggregate result set in an alternating manner rotating matched based on supplier. For exmaple, If the results set includes products from suppliers A, B, and C, the results would list 2 products from a table A, 2 products from table B, 2 products from table C, and then start over again with 2 from A and so forth until all the results were shown. I'm leaning towards searching each table separately using temporary tables for each table matches, then use alternating cursors from each temporary table to build the merged table.

Am I on the right track? Also, any ideas how to give different weighs to different suppliers. For example, listing 3 from A at a time, and 2 from the rest.

Thanks in advance!"
   

- Advertisement -