1 回答

TA貢獻1893條經(jīng)驗 獲得超10個贊
本來程序數(shù)據(jù)庫用的是mysql,后來轉(zhuǎn)為sql server2005,
其中一個sql為:
select * from dbo.sys_person_info t where t.VALID_FLAG>0
and t.dept_id in(select a.dept_code from sys_dept a,sys_dept b
where a.sort_no like concat(b.sort_no,'%') and b.dept_code ='37010001'
)
程序報錯:說concat函數(shù)不是內(nèi)置的函數(shù),原來是sql server沒有concat這個函數(shù),把代碼做了一下修改
代替了concat函數(shù),希望對大家有所幫助:
select * from dbo.sys_person_info t where t.VALID_FLAG>0
and t.dept_id in(select a.dept_code from sys_dept a,sys_dept b
where a.sort_no like b.sort_no + ''+'%' and b.dept_code ='37010001'
)
在oracle里的用法(沒有測試):
select * from dbo.sys_person_info t where t.VALID_FLAG>0
and t.dept_id in(select a.dept_code from sys_dept a,sys_dept b
where a.sort_no like b.sort_no || ''|| '%' and b.dept_code ='37010001'
)
- 1 回答
- 0 關(guān)注
- 470 瀏覽
添加回答
舉報