Select ID, Cat, Price, Name, AbbrvFrom(SELECt t1.ID, t1.Cat, t1.Price, t1.Price AS SortPrice, NULL as Name, NULL as Abbrv FROM t1UNIOnSELECt t2.ID, NULL as Cat, NULL as Price, t1.Price as SortPrice, t2.Name, t2.Abbrv FROM t2 inner join t1 on t2.id = t1.id) t3ORDER BY SortPrice DESC, Abbrv ASC
您必须以某种方式知道表2中的数据已链接到表1并共享价格。由于abbrv中的Null将排在最前面,因此无需创建SortAbbrv列。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)