如何从数据库中以下列格式显示数据?

时间:2018-04-19 19:22:56

标签: mysql sql

数据库表结构

enter image description here

数据需要显示

enter image description here

[b for a, b in mylist if a == '00001.ppm'] Please note:city_from未修复。它来自city_to表。但city已修复single_or_group_id1 = Single

2 个答案:

答案 0 :(得分:0)

  

应该试试这个。认为它会根据你的情况工作

select a.Trans_rent as Single, b.Trans_rent as Group 
from table as a 
inner join table as b on a.city_from = b.city_from and a.city_to = b.city_to 
and b.single_or_group_id = 2 
where a.single_or_group_id = 1

答案 1 :(得分:0)

你可以看到这个。希望它会对你有所帮助。

p
  | !{obj.text}