Joining Two Tables In Php - Programming - Nairaland
Nairaland Forum › Science/Technology › Programming › Joining Two Tables In Php (311 Views)
| 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: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: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:Thanks Man |
| Re: Joining Two Tables In Php by naijasensei: 12:34pm On Dec 07, 2020 |
walterjnr: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:Your method worked . |
Joining Tables In Mysqli Database • How To Arrange School Broadsheet Sheet From Mysql Tables • Combining Many Tables In Mysql • 2 • 3 • 4
Record Iphone Ringtone From Live Streams • 6 Tips To Make Your Website Lightning Fast • Best Method To Record Online Audio From Chrome