I am using FMDB and I am inserting data into my database with:
NSString *sql = [NSString stringWithFormat:@"insert into \"main\".\"DailyCycles\" ( \"objectID\",\"UserID\", \"Calories\") values ( '%@', '%@', %@)",
dailyTotal.objectId,
dailyTotal.userID,
dailyTotal.caloires,
];
However, I don't want duplicates in the database. I've tried "update into" but then it won't insert new data. Is there a way to ensure that data is inserted into the database when there is no existing record while just updating any existing records?