日期:2014-05-17 浏览次数:20923 次
WITH cars AS
(SELECT '1' carid,'东风' carname, '11' driveraid, '12' driverbid FROM dual),
driver AS
(SELECT '11' driverid,1 carnum,'aaa' drivername FROM dual UNION
SELECT '12' driverid,1 carnum,'bbb' drivername FROM dual )
SELECT CARID,
CARNAME,
(SELECT DRIVERNAME
------解决方案--------------------
'('
------解决方案--------------------
DRIVERID
------解决方案--------------------
')'
FROM DRIVER K
WHERE K.DRIVERID = CARS.DRIVERAID
AND K.CARNUM = CARS.CARID),
(SELECT DRIVERNAME
------解决方案--------------------
'('
------解决方案--------------------
DRIVERID
------解决方案--------------------
')'
FROM DRIVER K
WHERE K.DRIVERID = CARS.DRIVERBID
AND K.CARNUM = CARS.CARID) FROM CARS