Laravel 5 jointly queries tables An and B, what if ID conflicts

there are two tables An and B, both of which are similar in structure.

< hr >

A form

< table > < thead > < tr > < th > ID < / th > < th > name < / th > < th > state < / th > < / tr > < / thead > < tbody > < tr > < td > 1 < / td > < td > Zhang San < / td > < td > 0 < / td > < / tr > < tr > < td > 2 < / td > < td > Zhang San 2 < / td > < td > 1 < / td > < / tr > < / tbody > < / table >

B form

< table > < thead > < tr > < th > ID < / th > < th > content < / th > < th > UID < / th > < th > state < / th > < / tr > < / thead > < tbody > < tr > < td > 1 < / td > < td > content 1 < / td > < td > 1 < / td > < td > 1 < / td > < / tr > < tr > < td > 2 < / td > < td > content 2 < / td > < td > 2 < / td > < td > 1 < / td > < / tr > < / tbody > < / table >

now after the associated query through join
query statement is as follows:

$result = DB::table ("tableA")-> join (" tableB", "tableA.id"," =", "tableB.id")-> get ();

after the query results come out, the contents are aggregated together. The values of state and ID of table An are all overwritten by table B ID and state. How to rewrite

Jul.12,2022

I guess what you want to say is 'tableA.id',' =', 'tableB.uid'

  

as alias

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1beab51-31a37.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1beab51-31a37.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?