|Join Nairaland / LOGIN! / Trending / Recent / New|
Stats: 2,800,124 members, 6,692,477 topics. Date: Wednesday, 26 January 2022 at 06:11 AM
|Help Joining These Tables by walterjnr(m): 6:32pm On Feb 10, 2021|
Please help me with sql code to achieve the third table i.e transaction record using tblcustomer and tbltransaction table
|Re: Help Joining These Tables by Thenaijaitguy: 8:27pm On Feb 10, 2021|
SELECT customer.Fullname AS CustomerName, transaction.Operation AS TypeOfOperation, transaction.Amount
INNER JOIN customer ON customer.ID = transaction.ID
That's the SQL query. I also attached screen shot
|Re: Help Joining These Tables by walterjnr(m): 10:03pm On Feb 10, 2021|
God bless You
|Re: Help Joining These Tables by walterjnr(m): 10:29pm On Feb 10, 2021|
|Re: Help Joining These Tables by Thenaijaitguy: 10:36pm On Feb 10, 2021|
In a real system, a guest can not perform transaction. Except if you have Another table named quest .then you can joint it also.
|Re: Help Joining These Tables by Felixitie(m): 10:41pm On Feb 10, 2021|
Instead,try use right join.
|Re: Help Joining These Tables by nnamdiosu(m): 10:41am On Feb 11, 2021|
[quote author=walterjnr post=98947008][/quote]
1. You see that second table that you have a column called customer name, and instead you are putting customer id (2,1) and you still added a string called guest, it's very very wrong.
That place should be cudtomer_id and only the id of customers in the first table should be in that second table column.
2. A guest can't ever make a transaction. Everyone must be registered to have an id that will be in that second table column called customer name.
3. Also for safety and clarifications don't write deposited or withdrawal as a transaction type. Instead reference with with either 1 or 2.
It appears you are a newbie into programming? Well done...just continue practising you'll surely get there.
|Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health |
religion celebs tv-movies music-radio literature webmasters programming techmarket
Nairaland - Copyright © 2005 - 2022 Oluwaseun Osewa. All rights reserved. See How To Advertise. 40