is there a way to do an INSERT but on DUPLICATE KEY instead of an update do a SELECT?
Not in one query, but you coul run INSERT IGNORE <xxx> and then SELECT <xxx>. The IGNORE makes it ignore any rows that would trigger duplicate key errors instead of halting.
No. You will have to watch for the duplicate key error then issue your SELECT query. 
It'd be quite problematic if that existed since INSERT and UPDATE queries are meant to modify data and SELECT to return a result set. All kinds of drivers/interfaces handle these cases differently for good reason.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With