insert into reportmeterdatadictionary
  ( variabletype, SocketIndex, variablename,  variableunits)
select  'real',  max(SocketIndex),'Name', 'Unites' from Sockets;

解决方案 »

  1.   

    SELECT LAST_INSERT_ID(); 返回值
      

  2.   

    那两条语句怎么执行。 用分号隔开只执行了一条sql语句。比如:
    insert into reportmeterdatadictionary
      ( variabletype, SocketIndex, variablename,  variableunits)
    select  'real',  max(SocketIndex),'Name', 'Unites' from Sockets;
    insert into ABC
      (SocketIndex, variablename)
    select  max(SocketIndex),'Unites' from Sockets;