In your case you have 2 tables. People
and Dates
from which you want to fetch data. You can use the below SQL Query with INNER JOIN
.
SELECT People.*, Dates.* FROM People INNER JOIN Dates ON People.id_number = Dates.number"
Please note that you can append SQL Query from WHERE
and with ORDER BY
and/or LIMIT
as you would normally do.
Explanation of this is below:
First you have SELECT
. After that you have People.*
, which means that All from table People. So you write table name and the .
and field (*
for All). Add a comman ,
after this and then the next table with the same syntax. In your case it is Dates.*
. Then you add FROM
First Table Name. After this you add INNER JOIN
and Second Table Name. After this you define the reference between the two tables by ON
and then the fields from both the tables People.id_number = Dates.number
. Syntax is the same, Table.Field
.
Now you can simply display the result normally.
Please note that I have provided you with the SQL Query that you can insert in your code. It might be PDO or Prepared Statement.
If you require further clarification, do not hesitate in letting me know.
Hope this helps.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…