I was just wondering the best way to do this.
I have a database with 2 tables.
First Table
id - primary key
title
Second Table
id - primary key
first_id
order
I was wondering what is the best way to make sure if when inserting if the combination of first_id and order exists then update else insert?
eg if I try inserting a record into the Second Table first_id = 10 and order = 1 and that already exists then update instead of insert a new record. I read somewhere about making a combination of columns unique but wasn't sure how to.
EDIT: Sorry I forgot to mention that im using MySQL