"zazu" <mike.dreaneen@gmail.comwrote in message
news:1182764172.643832.272950@i38g2000prf.googlegr oups.com...
Quote:
We have a database of books. The main table has a few fields of which
SKU and CATEGORY are two. The SKU field stores either 10 or 13 digit
isbn's. This field is a text field as some of the isbn's have one or
two leading zeros. Each SKU is unique.
>
We would like to run a QUERY that results in a table of, say, five
randomnly selected SKU's for each unique SKU - other data for the
unique SKU would be included such as title, author etc. The result
could be like this:
>
SKU TITLE AUTHOR RANDOM_SKU_ONE RANDOM_SKU_TWO
RANDOM_SKU_THREE RANDOM_SKU_FOUR RANDOM_SKU_FIVE
>
We have tried with queries but always get thousands of lines with the
same unique SKU. Have even tried querying queries.
>
The challenge for us is that we have skills limited to using simple
queries etc. Can anybody assist or tell us that it cannot be done
please
>
The purpose is so that we can say to customers "Thank you for buying
this book, here are five others you may like"
>
SKU would be hard to select with random numbers, If you have or can add an
auto number field to you SKU table the "RND" function may help. You would
need some VBA code to generate the random numbers to use in a the "IN"
clause of a query.
SkuID IN (23,200,567,1245,9878)
PS:
Random books would not be very helpful me. Why not use a query to select the
top 5 books purchased by customers that purchased the selected book?