select a.*,b.name as appname,(case a.dbsrctype when 1 then (select serverIp||':'||port||','||username||'/'||password||'@'||dbname from t_database d where d.id=a.id) else (select url from t_webservice w where w.id=a.id) end) as vmark from t_dbsrc a left join t_appsys b on a.appid=b.id