MySQL Insert if Condition
I Have this cat id - post id relation table.
+----+--------+---------+
| id | cat_id | post_id |
| | | |
| 1 | 11 | 32 |
| 2 | ... | ... |
+----+--------+---------+
I use SELECT WHERE cat_id = 11 AND post_id = 32 and then if no result
found, I do INSERT. Can I rewrite these two queries in One?
No comments:
Post a Comment