问题:在数据库中查询数据,代码如下:
select count(1) from (
select a.device_id as "deviceId",
a.sevice_type as "seviceType",
a.pw_id as "pwId",
a.a_local_sign as "aLocalSign",
a.a_remote_sign as "aRemoteSign",
a.serv_port as "servPort",
a.serv_vlan as "servVlan",
a.status as "status",
a.zb_pw_flag as "zbPwFlag",
a.gather_time as "gatherTime",
a.device_name as "deviceName",
a.loopback_ip as "loopbackIp",
a.city_name as "cityName",
b.portdesc as "portDesc" from (
select
a.device_id,
a.sevice_type,
a.pw_id,
a.a_local_sign,
a.a_remote_sign,
a.serv_port,
a.serv_vlan,
a.status as,
a.zb_pw_flag,
a.gather_time,
b.device_name,
b.loopback_ip,
c.city_name
from ipran_a_pw_resource a,tab_deviceresource b,tab_city c
where a.device_id=b.device_id and b.city_id=c.city_id
order by a.device_id,a.sevice_type,a.a_local_sign) a
left join ipran_port_ip b on a.device_id=b.device_id and a.serv_port=b.portname) t
执行后报错,各种忽略了剩余的行,经过查询发现是因为sql语句里有一行空行,出现了这个问题。去掉空行后问题就解决了。