inserting 2 fields from 1 table to another table

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hridya
    New Member
    • Mar 2008
    • 6

    inserting 2 fields from 1 table to another table

    hai all


    I am using a query to insert 2 fields from my temp table( emp_attendance_ temp ) to the attendance table.
    insert is happening but the problem is emp_attendance tables id is set as the id of the temp tables id.

    I don't want to set the ID from the temp table.
    i want the Id in emp_attendance in its incremental sequence


    INSERT INTO emp_attendance (employee_id,at tendance_status _code) select employee_id,att endance_status_ code from emp_attendance_ temp
  • hridya
    New Member
    • Mar 2008
    • 6

    #2
    Originally posted by hridya
    hai all


    I am using a query to insert 2 fields from my temp table( emp_attendance_ temp ) to the attendance table.
    insert is happening but the problem is emp_attendance tables id is set as the id of the temp tables id.

    I don't want to set the ID from the temp table.
    i want the Id in emp_attendance in its incremental sequence


    INSERT INTO emp_attendance (employee_id,at tendance_status _code) select employee_id,att endance_status_ code from emp_attendance_ temp

    Heading:inserti ng 2 fields from 1 table to another table

    Comment

    • ronverdonk
      Recognized Expert Specialist
      • Jul 2006
      • 4259

      #3
      Can't really guess what your problem is here. But if you don't want to insert the attendance_id into the attendance table, then isn't this the statement you look for[code=mysql]INSERT INTO emp_attendance (0,attendance_s tatus_code) select attendance_stat us_code from emp_attendance_ temp
      [/code]Ronald

      Comment

      • hridya
        New Member
        • Mar 2008
        • 6

        #4
        oh i am sorry

        the problem is with sqlyog.when i closed and restarted it works correctly


        your answer given is correct(the problem was my Id was not setting correct)

        thanks

        Comment

        • ronverdonk
          Recognized Expert Specialist
          • Jul 2006
          • 4259

          #5
          Originally posted by hridya
          oh i am sorry

          the problem is with sqlyog.when i closed and restarted it works correctly


          your answer given is correct(the problem was my Id was not setting correct)

          thanks
          Glad it works correct now. See you again next time.

          Ronald

          Comment

          Working...