Jump to content

jtm62

New Members
  • Posts

    9
  • Joined

  • Last visited

    Never

Everything posted by jtm62

  1. fair enough.
  2. Yes. It would be debit (-) amount for the source account and a deposit (+) amount for the destination account. @jtm62, having a second table that duplicates the balance from the account table is redundant information and is not necessary (do you keep track of your checking account by keeping track of the deposits/debits in one place and keeping track of the balance in another place?) I'm not duplicating anything. I'm recording the amount, the payee, and the payer in the second table. Personally, I want some way to know who paid who, and who received what from who... and I want a separate table to do that. I don't feel it appropriate to record the second account id in my account balance table when making a transaction.
  3. I would have two tables. Account_Balances (account_ID, account_Balance, timestamp) && Transaction_Records (payer, payee, amount, timestamp) Then I would have three records... two updates and one insert all wrapped in a transaction to maintain the acid transaction. "update Account_Balances set account_Balance=account_Balance-{$amount} where account_ID='{$transferee}';"; "update Account_Balances set account_Balance=account_Balance+{$amount} where account_ID='{$receiver}';"; "insert into Transaction_Records (payer, payee, amount) values ('{$transferee}','{$receiver}',{$amount});"; This assumes both accounts are at the same bank, of course. And this design is super simple meant to address your base question... I'm sure with more time and energy I could brainstorm a whole bank, but I don't have the time or the energy...
  4. For starters your order by clause should not be before the where clause.
  5. Doing something similar to the below should result in what you are looking for, with a caveat: $sql="select f.fixtureYear, f.fixtureVenue, tt1.teamName as t1, tt2.teamName as t2 from fixture f, team tt1, team tt2 where f.teamID=tt1.teamID and f.teamID=tt2.teamID and tt1.t1<>tt2.t2"; The problem with the above is it should return two results per game... because either team can be team one or team two... so it will produce a result set with it both ways. If you can come up with a way to define the home team as team one it will only return one result (but this will require additional tables... and if it is a neutral site you need more logic...)
  6. The correct syntax for SQL join statements is: SELECT column_name(s) FROM table_name1 INNER JOIN table_name2 ON table_name1.column_name=table_name2.column_name This may not solve all your problems... but it should start to return some results.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.