我正在尝试使用以下查询从表中获取数据:
$query = "SELECT wplt_wpl_properties.mls_id,
wplt_wpl_properties.property_type,
wplt_wpl_properties.location1_name,
wplt_wpl_properties.price,
wplt_wpl_properties.price_unit,
wplt_wpl_properties.lot_area,
wplt_wpl_properties.lot_area_unit,
wplt_wpl_properties.build_year,
wplt_wpl_property_types.id,
wplt_wpl_property_types.name,
wplt_wpl_units.id AS units_id,
wplt_wpl_units.name AS units_name
FROM wplt_wpl_properties
INNER JOIN wplt_wpl_property_types
ON wplt_wpl_properties.property_type=wplt_wpl_property_types.id INNER JOIN wplt_wpl_units ON units_id=wplt_wpl_properties.price_unit";
html/php部分
<tr>
<td style="vertical-align: middle;"><?php echo $count; ?></td>
<td style="vertical-align: middle;"><?php echo $row['mls_id']; ?></td>
<td style="vertical-align: middle;"><?php echo $row['name']; ?></td>
<td style="vertical-align: middle;"><?php echo $row['location1_name']; ?></td>
<td style="vertical-align: middle;"><?php echo $row['price']; ?></td>
<td style="vertical-align: middle;"><?php echo $row['units_name']; ?></td>
<td style="vertical-align: middle;"><?php echo $row['lot_area']; ?></td>
<td style="vertical-align: middle;"><?php echo $row['lot_area_unit']; ?></td>
<td style="vertical-align: middle;"><?php echo $row['build_year']; ?></td>
</tr>
但没有任何结果。
2条答案
按热度按时间dgtucam11#
你有
在您的选择和
在on子句中,最后一位应该是
py49o6xq2#
我犯了个错误,没看到。而不是
ON units_id=wplt_wpl_properties.price_unit
应该是INNER JOIN wplt_wpl_units ON wplt_wpl_units.id=wplt_wpl_properties.price_unit