问一个插入数据的语句
本帖最后由 qw122546 于 2013-01-31 17:52:36 编辑
我要插入
INSERT INTO SYS_PRSNL (PRSNL_ID, PRSNL_NUM, UNIT_ID, FULL_NAME)
其中
PRSNL_ID= ISNULL(MAX(PRSNL_ID),0)+1
PRSNL_NUM = TEST01
UNIT_ID = SELECT UNIT_ID FROM SYS_UNIT WHERE UNIT_NUM = 'TEST01'
FULL_NAME = 系统管理员
请问要怎么写
------解决方案--------------------INSERT INTO SYS_PRSNL (PRSNL_ID, PRSNL_NUM, UNIT_ID, FULL_NAME)
value (
select ISNULL(MAX(PRSNL_ID),0)+1 from SYS_PRSNL
'TEST01',
SELECT UNIT_ID FROM SYS_UNIT WHERE UNIT_NUM = 'TEST01',
'系统管理员'
)
)