In MySql is it possible to do something like this in a statement that is to be used in PHP and not in a stored procedure or anything else.
if(select count(*) from reports where empId = 9 and repId = 10 = 0,'Do an insert',' Update the existing row')// Just for example
I know about the INSERT ... ON DUPLICATE KEY UPDATE
thing. But I cannot use that.
CREATE TABLE `reports` (
`genId` INT(11) NOT NULL AUTO_INCREMENT,
`name` VARCHAR(50) NULL DEFAULT NULL,
`designation` VARCHAR(50) NULL DEFAULT NULL,
`empId` INT(11) NULL DEFAULT NULL,
`repId` INT(11) NULL DEFAULT NULL,
PRIMARY KEY (`genId`)
)