₦airaland Forum

Welcome, Guest: RegisterLoginWith GoogleTrendingRecentNew

Stats: 3,325,840 members, 8,423,888 topics. Date: Wednesday, 10 June 2026 at 11:48 AM

Toggle theme

Joining Two Tables In Php - Programming - Nairaland

Nairaland ForumScience/TechnologyProgrammingJoining Two Tables In Php (311 Views)

1 Reply (Go Down)

Joining Two Tables In Php by walterjnr(op): 8:05am On Dec 07, 2020
Please I need help.
This image will explain everything. Thanks

Re: Joining Two Tables In Php by hollyfat(m): 9:19am On Dec 07, 2020
SELECT referenceID,email,transaction_type,payment_method,Amt FROM tbltransaction UNION SELECT referenceID,email,transaction_type,payment_method,Amt FROM tbltransactionbank



By the way, you can use the same table and add make the teller column optional
Re: Joining Two Tables In Php by fnep2smooth(m): 9:54am On Dec 07, 2020
walterjnr:
Please I need help.
This image will explain everything. Thanks
First learn PHP inner Join it will help you join tables so that you can echo out the data's easily.


Then write a function for the table... Something like

SELECT * referenceid,email, transaction_type, payment_method, amt from tbltransaction INNER JOIN tbltransactionbank WHERE id="";


Google this .... Just feel like to give you a clue.. you can try Stackoverflow
Re: Joining Two Tables In Php by walterjnr(op): 10:08am On Dec 07, 2020
hollyfat:
SELECT referenceID,email,transaction_type,payment_method,Amt FROM tbltransaction UNION SELECT referenceID,email,transaction_type,payment_method,Amt FROM tbltransactionbank



By the way, you can use the same table and add make the teller column optional
The design of the system did not allow me to use one table.
Re: Joining Two Tables In Php by walterjnr(op): 10:08am On Dec 07, 2020
hollyfat:
SELECT referenceID,email,transaction_type,payment_method,Amt FROM tbltransaction UNION SELECT referenceID,email,transaction_type,payment_method,Amt FROM tbltransactionbank



By the way, you can use the same table and add make the teller column optional
Thanks Man
Re: Joining Two Tables In Php by naijasensei: 12:34pm On Dec 07, 2020
walterjnr:
Please I need help.
This image will explain everything. Thanks
First off, this isn't PHP - it is SQL, most likely MYSQL. Secondly, what are you doing? Thirdly, the second table is exactly the same as the first table, save for one column. Finally, aren't the columns in the proposed third table the same as those in the first table?
If you want my candid opinion, that database schema needs to be redesigned ASAP. It would be more efficient to have only a "tbltransaction" table and drop the "tbltransactionbank" table. Better still, you can keep the "tbltransaction" table while changing the transaction_type to type_id (or transaction_type_id) which will link to a transaction_type table. As a developer, always remember you have finite resources; don't waste computing resources on inefficient tasks.
Re: Joining Two Tables In Php by walterjnr(op): 2:38pm On Dec 07, 2020
hollyfat:
SELECT referenceID,email,transaction_type,payment_method,Amt FROM tbltransaction UNION SELECT referenceID,email,transaction_type,payment_method,Amt FROM tbltransactionbank



By the way, you can use the same table and add make the teller column optional
Your method worked .
1 Reply

Joining Tables In Mysqli DatabaseHow To Arrange School Broadsheet Sheet From Mysql TablesCombining Many Tables In Mysql234

Record Iphone Ringtone From Live Streams6 Tips To Make Your Website Lightning FastBest Method To Record Online Audio From Chrome