我试图根据它收到的规格表值在“规格”列表中显示表格的所有“汽车”。
表:
汽车:
dcar: 1 / width:30 / length:10 / weight:300
idcar: 2 / width:20 / length:12 / weight:210
idcar: 3 / width:20 / length:21 / weight:230
idcar: 4 / width:40 / length:11 / weight:210
规格表:
idspec:1 spec:width
idspec:2 spec:weight
idspec:3 spec:length
输出将是:
Width
car-1 width-30
car-2 width-20
car-3 width-20
car-4 width-40
Weight
car-1 weight-300
car-2 weight-210
car-3 weight-230
car-4 weight-210
Length
car-1 length-10
car-2 length-12
car-3 length-21
car-4 length-11
我的查询可以吗?我想在一段时间内使用它或 foreach (php)
$resultjoin = mysqli_query($connecDB,"SELECT specs.idspec, specs.spec, cars.idcar FROM (specs) LEFT JOIN cars ON cars.idcar = specs.idspec");
谢谢!