更新时间:2022-12-10 17:25:52
这是一个原始的MySQL查询,可以解决这个问题:
Here is a raw MySQL query which should do the trick:
SELECT t1.*
FROM record_items t1
LEFT JOIN property_values t2
ON t1.id = t2.REC AND
t2.property = 'age'
ORDER BY CASE WHEN t2.value IS NULL THEN 1 ELSE 0 END, t2.Value
我注意到您在property_values
中的Value
列正在混合数字和文本数据.这不能很好地用于排序目的.
I notice that your Value
column in property_values
is mixing numeric and text data. This won't work well for sorting purposes.