mysql - Any trick to make a query that ouputs no row when certain conditions are satisfied and a row when they are not (without subselects)? -
maybe it's obvious, sure has simple way that
select 'not contained yet' flagrow ( select 'already contained' mytable t t.id=? , curdate()=t.date limit 1 ) aux having count(*)=0 that returns no results if register in database (by id,date) , returns row message 'not contained yet' if not exist.
any way query particularity without using subselects? need single row gibberish acts trigger starting etl in case there no entries day , id
you should able having:
select 'not contained yet' flagrow mytable t t.id = ? , curdate()=t.date having count(*) = 0; mysql sql subquery
No comments:
Post a Comment