Re: online lottery system
Posted by: Huu Da Tran
Date: May 09, 2008 09:31AM

Eventhough in case 1, your ordering is not important, you might want to know in statistical views how many times a given number was drawn first, etc...

So if you get a table like:

Case 1:
mysql> create table `tc` (`drawID` int, `order` int, `number` int,
    ->   unique index `drawOrder` (`drawID`, `order`),
    ->   unique index `drawNumber` (`drawID`, `number`));
mysql> create view `vc` as
    ->   select `drawID`, group_concat(`number` separator '') as 'combination'
    ->     from `tc`
    ->     group by `drawID`
    ->     order by `number` asc;

Case 2:
mysql> create table `tn` (`drawID` int, `order` int, `number` int,
    ->   unique index `drawOrder` (`drawID`, `order`));
mysql> create view `vn` as
    ->   select `drawID`, group_concat(`number` separator '') as 'combination'
    ->     from `tn`
    ->     group by `drawID`
    ->     order by `order` asc;


Hope this is a good start,
H.

Options: ReplyQuote


Subject
Written By
Posted
May 07, 2008 09:51AM
Re: online lottery system
May 09, 2008 09:31AM


Sorry, you can't reply to this topic. It has been closed.
This forum is currently read only. You can not log in or make any changes. This is a temporary situation.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.