我有以下 SELECT 语句,并且基于我在这里看到的内容:SQL Select Max Date with Multiple records我的示例以相同的方式设置。我在 Oracle 11g 上。它不是为每个asset_tag 返回一条记录,而是返回多个记录。没有源表中的记录那么多,但(我认为)应该多。如果我运行内部 SELECT 语句,它还会返回正确的记录集(每个asset_tag 1 个),这真的让我很难过。
SELECT
outside.asset_tag,
outside.description,
outside.asset_type,
outside.asset_group,
outside.status_code,
outside.license_no,
outside.rentable_yn,
outside.manufacture_code,
outside.model,
outside.manufacture_vin,
outside.vehicle_yr,
outside.meter_id,
outside.mtr_uom,
outside.mtr_reading,
outside.last_read_date
FROM mp_vehicle_asset_profile outside
RIGHT OUTER JOIN
(
SELECT asset_tag, max(last_read_date) as last_read_date
FROM mp_vehicle_asset_profile
group by asset_tag
) inside
ON outside.last_read_date=inside.last_read_date
有什么建议么?