db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rajesh Kartha <karth...@gmail.com>
Subject Re: How to select a random record.
Date Mon, 26 Dec 2005 03:07:38 GMT
Maybe there are other ways to perform this, but the first thing that came to
my mind was to create a
Java stored procedure.  This can use simple Java code to create the logic
needed and return
a result set from the products table based on the categories and a generated
random number.

Syntax for creating procedures:
http://db.apache.org/derby/docs/10.1/ref/rrefcreateprocedurestatement.html

Example:
http://www-128.ibm.com/developerworks/db2/library/techarticle/dm-0408anderson/#cs_sp

Hope the above helps.

-Rajesh



On 12/25/05, Legolas Woodland <legolas.w@gmail.com> wrote:
>
> Hi
> Thank you for reading my post.
> I have a Product table and a category table.
> some of products exists in more than one category.
> I should select a random product from product table (a record)  and it
> should be from some certain categories.
> Now the question is :
> What is best solution to select a random product which is in one or more
> categories ( categories are  determined by users ).
>
>
> Thank you
>
>

Mime
View raw message