| Author | Topic | 
                            
                                    | programerPosting Yak  Master
 
 
                                        221 Posts | 
                                            
                                            |  Posted - 2011-04-23 : 15:41:24 
 |  
                                            | tbl_slip: - StakeStatus 1: OpenType of bet SingleBetting account number 7Ticket no. 38207Date 23/04/11 20:38Status OpenStake 2.00 $Odd 1.30Max. 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: incorrectType of bet SingleBetting account number 7Ticket no. 38207Date 23/04/11 20:38Status OpenStake 2.00 $Odd 1.30Max. winnings 2.60 $     (2.00 * 1.30) = 2.60 $Winnings 0.00 $Status 3: correctType of bet SingleBetting account number 7Ticket no. 38207Date 23/04/11 20:38Status OpenStake 2.00 $Odd 1.30Max. 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_sliptbl_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 3Bilanca: 10,60 $TicketNo 38207 - 2.00 $ - paid the amountTicketNo 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? |  | 
       
                            
                       
                          
                            
                                    | nigelrivettMaster 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. |  
                                          |  |  | 
                            
                       
                          
                            
                                    | robvolkMost 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 |  
                                          |  |  | 
                            
                       
                          
                            
                                    | programerPosting Yak  Master
 
 
                                    221 Posts | 
                                        
                                          |  Posted - 2011-04-23 : 16:22:32 
 |  
                                          | quote: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?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.
 
 |  
                                          |  |  | 
                            
                       
                          
                            
                                    | programerPosting Yak  Master
 
 
                                    221 Posts |  | 
                            
                       
                          
                            
                                    | nigelrivettMaster 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. |  
                                          |  |  | 
                            
                       
                          
                            
                                    | programerPosting Yak  Master
 
 
                                    221 Posts | 
                                        
                                          |  Posted - 2011-04-23 : 16:50:48 
 |  
                                          | quote:So tbl_balance design table:column:BonusBalance $ 1000RealBalance $ 0If you use $ 200 on the website, the RealBalance $ 200?Or this:Column AttributeName | AmountBonusBalance | $ 1000Real Balance | $ 0This 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?RegardsOriginally 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.
 
 |  
                                          |  |  | 
                            
                       
                          
                            
                                    | nigelrivettMaster 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. |  
                                          |  |  | 
                            
                       
                          
                            
                                    | programerPosting Yak  Master
 
 
                                    221 Posts | 
                                        
                                          |  Posted - 2011-04-23 : 18:41:45 
 |  
                                          | quote:UserId	uniqueidentifier	UncheckedAttributeName	nvarchar(500)	CheckedAmount	decimal(18, 2)	CheckedTransactionId	nvarchar(1000)	CheckedDate	datetime	CheckedAttrubuteName | Amount | TransactionId | DateDeposit	        10,00	   58878	  24.4.2011 0:00:00Bonus	        10,00	   58878	  24.4.2011 0:00:00I 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?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.
 
 |  
                                          |  |  | 
                            
                       
                          
                            
                                    | nigelrivettMaster Smack Fu Yak Hacker
 
 
                                    3385 Posts | 
                                        
                                          |  Posted - 2011-04-23 : 18:48:39 
 |  
                                          | It's usual to have something likeTransactionIDDateUserIDTransactionTypeIDamountTransactionTypeiddescription==========================================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. |  
                                          |  |  | 
                            
                            
                                |  |