Author |
Topic |
programer
Posting Yak Master
221 Posts |
Posted - 2011-04-23 : 15:41:24
|
tbl_slip: - Stake
Status 1: Open
Type of bet Single Betting account number 7 Ticket no. 38207 Date 23/04/11 20:38 Status Open Stake 2.00 $ Odd 1.30 Max. winnings 2.60 $ (2.00 * 1.30) = 2.60 $ Winnings 0.00 $
This event is opened, which means that are Winnings 0.00 $. When the event is completed, is the Status: Correct or Incorrect.
If the bet is incorrect is the "Winnings" 0.00 $.
Status 2: incorrect
Type of bet Single Betting account number 7 Ticket no. 38207 Date 23/04/11 20:38 Status Open Stake 2.00 $ Odd 1.30 Max. winnings 2.60 $ (2.00 * 1.30) = 2.60 $ Winnings 0.00 $
Status 3: correct
Type of bet Single Betting account number 7 Ticket no. 38207 Date 23/04/11 20:38 Status Open Stake 2.00 $ Odd 1.30 Max. winnings 2.60 $ (2.00 * 1.30) = 2.60 $ Winnings 2.60 $
If the bet is correct is the "Winnings" 2.60 $.
This is the table tbl_slip
tbl_transactions: AmountTransactions | TicketNo | transactionDate | TransactionType -2.00 $ | 38207 | 23/04/11 20:38 | Stake - check Status 1 +10.00 $ | | 25/04/11 15:00 | deposit +2.60 $ | 38207 | 26/04/11 17:45 | Winnings - check Status 3
Bilanca: 10,60 $
TicketNo 38207 - 2.00 $ - paid the amount
TicketNo 38207 - 2.60 $ - shows only the amount, if the bet is correct.
I need JOIN both tables? I need an extra the column "Balance" in the table tbl_transactions? If you merge two tables how to get the amount of $ 10.60, if I do not have the column "Balance" in the table tbl_transactions ?
Why do I need an extra column "Balance" in tbl_transactions, if you can combine two tables?
Should I use Stored procedure to store the same data "Amount - tbl_slip" -> "Balance - tbl_transactions"?
Why do we need the column "Balance" and tbl_transactions? |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-04-23 : 16:12:33
|
your slip table is to do with bets - what if a user pays money into an account or withdraws without placing a wager. That would be a transaction and probably held in the transaction table.
Why do you need an extra column balance? To keep track of the balance in case you want to archive, for efficiency so you don't have to sum the whole table? So you can easily track the balance changes? The other question is should you have a seperate balance table.
I would use stored procedures to maintain the system if possible.
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy. |
 |
|
robvolk
Most Valuable Yak
15732 Posts |
Posted - 2011-04-23 : 16:19:11
|
Didn't you ask the same question 2 days ago:
http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=159774 |
 |
|
programer
Posting Yak Master
221 Posts |
Posted - 2011-04-23 : 16:22:32
|
quote: Originally posted by nigelrivett
your slip table is to do with bets - what if a user pays money into an account or withdraws without placing a wager. That would be a transaction and probably held in the transaction table.
Why do you need an extra column balance? To keep track of the balance in case you want to archive, for efficiency so you don't have to sum the whole table? So you can easily track the balance changes? The other question is should you have a seperate balance table.
I would use stored procedures to maintain the system if possible.
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.
Have you given me think. If the user paid and the money raised back to the account, this is not good. Would you create a table tbl_balance, which would have information if the money was used on the website? |
 |
|
programer
Posting Yak Master
221 Posts |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-04-23 : 16:29:24
|
I would probably have a transaction and a balance table. Transaction would sum to give the balance if needed but balance would be maintained by an insert into the transaction table.
What happens if a wager is declared void? With the transaction table the money is just credited back to the account.
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy. |
 |
|
programer
Posting Yak Master
221 Posts |
Posted - 2011-04-23 : 16:50:48
|
quote: Originally posted by nigelrivett
I would probably have a transaction and a balance table. Transaction would sum to give the balance if needed but balance would be maintained by an insert into the transaction table.
What happens if a wager is declared void? With the transaction table the money is just credited back to the account.
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.
So tbl_balance design table:
column: BonusBalance $ 1000 RealBalance $ 0
If you use $ 200 on the website, the RealBalance $ 200?
Or this: Column AttributeName | Amount BonusBalance | $ 1000 Real Balance | $ 0
This means that you can use an unlimited bonus because it can be an unlimited number of bonuses to different conditions. Therefore, I do not know which columns will be added to and used instead of two which is recorded all the information?
Regards |
 |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-04-23 : 17:08:00
|
That's a business requirement you are modelling. Without knowing the business it's difficult to comment on the design.
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy. |
 |
|
programer
Posting Yak Master
221 Posts |
Posted - 2011-04-23 : 18:41:45
|
quote: Originally posted by nigelrivett
That's a business requirement you are modelling. Without knowing the business it's difficult to comment on the design.
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy.
UserId uniqueidentifier Unchecked AttributeName nvarchar(500) Checked Amount decimal(18, 2) Checked TransactionId nvarchar(1000) Checked Date datetime Checked
AttrubuteName | Amount | TransactionId | Date Deposit 10,00 58878 24.4.2011 0:00:00 Bonus 10,00 58878 24.4.2011 0:00:00
I have to create a new table to check how much the user has used the money on a website? Or stored as attributename - Deposit Wager - Bonus Wager
? |
 |
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2011-04-23 : 18:48:39
|
It's usual to have something like Transaction ID Date UserID TransactionTypeID amount
TransactionType id description
========================================== Cursors are useful if you don't know sql. SSIS can be used in a similar way. Beer is not cold and it isn't fizzy. |
 |
|
|