Php 使用左外部联接检索数据
我希望能够匹配表1中的字段,并将表1中的数据与表2中的匹配字段一起回送。我尝试了下面的方法,但没有成功 例如: 我想按以下顺序回显数据:Php 使用左外部联接检索数据,php,mysql,join,Php,Mysql,Join,我希望能够匹配表1中的字段,并将表1中的数据与表2中的匹配字段一起回送。我尝试了下面的方法,但没有成功 例如: 我想按以下顺序回显数据:项目(表1)、类别(表1)、preice(表2)、买家(表1) 预期结果:fr732001fruits 3.20as1您的Sql语法看起来有点不稳定。尝试: SELECT Table1.items, Table1.category, Table1.buyer, Table2.price, Table2.stocks FROM
项目(表1)、类别(表1)、preice(表2)、买家(表1)
预期结果:
fr732001fruits 3.20as1
您的Sql语法看起来有点不稳定。尝试:
SELECT
Table1.items,
Table1.category,
Table1.buyer,
Table2.price,
Table2.stocks
FROM Table1
LEFT OUTER JOIN Table2 ON Table2.item = Table1.items
WHERE Table1.items = $...
查询应该是
SELECT Table1.items,
Table1.category,
Table1.buyer,
Table2.price,
Table2.stocks
from Table1
LEFT OUTER JOIN Table2
ON Table2.item = Table1.items
WHERE Table1.items = 'fr732001';
@莉亚纳塔莉,如果有用的话,别忘了标记答案。
SELECT Table1.items,
Table1.category,
Table1.buyer,
Table2.price,
Table2.stocks
from Table1
LEFT OUTER JOIN Table2
ON Table2.item = Table1.items
WHERE Table1.items = 'fr732001';