# SQL Query

**URL:** <https://forum.kirupa.com/t/sql-query/155904>\
**Category:** programming\
**Created:** [July 21, 2005, 4:55am UTC](https://forum.kirupa.com/t/sql-query/155904 "2005-07-21T04:55:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![r27122003](https://avatars.discourse-cdn.com/v4/letter/r/90ced4/32.png) [@r27122003](https://forum.kirupa.com/u/r27122003)\
**Post date:** [July 21, 2005, 4:55am UTC](https://forum.kirupa.com/t/sql-query/155904/1 "2005-07-21T04:55:16Z")

</div>

Hi friends… please help me…  
my problem is…

i have four tables  
1 - category - consists of category id,category name  
2 - publisher - consists of publisher details  
3 - product - consists of publisherid, categoryid and product details  
4 - topsellers - consists of categoryid…

i have to display…  
1 - all the categories which appears in the topseller table with,  
2 - all the products in that particular category  
3 - if there is more than one product in that particular category, only one should be displayed RANDOMLY… Random is the important word… each time when i refresh the page, the page should be displayed with the same category in the same order, but the products randomly…

iam waiting for your replay,  
thank you  
R
