小弟 跪求高手!怎么将两个sql语句和一起 既查出起始-中转-到达城市的信息也查出起始-到达城市的信息
//查的是起始-中转-到达城市的信息
select c1.*, a1.area as StartCity, a2.area as MidCity, a3.area as EndCity from `customer` as c1, `area` as a1, `area` as a2, `area` as a3 where c1.StartCity = a1.value and c1.EndCity = a3.value and c1.MidCity = a2.value
//查的是起始-到达城市的信息
select c1.*, a1.area as StartCity, a2.area as MidCity, a3.area as EndCity from `customer` as c1, `area` as a1, `area` as a2, `area` as a3 where c1.StartCity = a1.value and c1.EndCity = a3.value and c1.MidCity = a2.value
请问 怎么将两个sql语句和一起 既查出起始-中转-到达城市的信息也查出起始-到达城市的信息
------解决方案--------------------
SQL code
select c1.*, a1.area as StartCity, a2.area as MidCity, a3.area as EndCity from `customer` as c1, `area` as a1, `area` as a2, `area` as a3 where c1.StartCity = a1.value and c1.EndCity = a3.value and c1.MidCity = a2.value
union all
select c1.*, a1.area as StartCity, a2.area as MidCity, a3.area as EndCity from `customer` as c1, `area` as a1, `area` as a2, `area` as a3 where c1.StartCity = a1.value and c1.EndCity = a3.value and c1.MidCity = a2.value