Hi Shreyas,
IF functions in MySQL are like Excel:
IF(expression_to_test, expression_if_true, expression_if_false)
So yours would be something like:
IF ((SELECT count(SendDataID) from sendoutputs where RunID = 257) > 0),
(ro.RunID = 257 and sops.SendDataID in (SELECT max(SendDataID) from sendoutputs where RunID = 257)),
(ro.RunID = 257))
Don’t know if using an IF in a WHERE clause is the best way to go or not, but sometimes it can’t be helped.