1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

insert data into database without duplicates

Discussion in 'Meet and Greet' started by mpho marumo, Apr 26, 2011.

  1. mpho marumo

    mpho marumo New Member

    Apr 26, 2011
    Likes Received:
    Trophy Points:
    I have reached the brick wall, been trying to write code to insert data into database without repeating "already" the inserted row
    here is what I have
    INSERT INTO roshcon_vehicle_v1_0 VALUES (VehicleRegNumber,VehicleType,VehicleMake,rjbFstName,rjbSurname,rjbTelNr1Number,rjbSubName,rjbTelNr4Number,rjbSubManagerEmail,Hire_Time) ON DUPLICATE KEY UPDATE VehicleRegNumber = '$VehicleRegNumber', SELECT roshcon_vehicle_report_001.VehicleRegNumber, VehicleType,VehicleMake, roshcon_vehicle_drivers_v1_0.rjbFstName, rjbSurname,rjbTelNr1Number,rjbSubName,rjbTelNr4Number,rjbSubManagerEmail, Hire_Time FROM roshcon_vehicle_driver_v1_0, roshcon_vehicle_report_001, roshcon_vehicle_drivers_v1_0 WHERE roshcon_vehicle_report_001.VehicleId = roshcon_vehicle_driver_v1_0.Id AND roshcon_vehicle_drivers_v1_0.rjbId = roshcon_vehicle_driver_v1_0.rjbFstName

    I get (Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SELECT roshcon_vehicle_report_001.VehicleRegNumber, VehicleType,VehicleMake, ros' at line 4)

Share This Page