vendredi 15 juillet 2016

sql query to run based on a column value

I have a table with below values for database : db1

database   sync_status     validation    remark
db1        successful      failed        error
db1        successful      successful    all is well

I don't want the query to return any row, if the validation is successful for database db1. But in my case it is returning the row with failed validation.

select database,sync_status,validation,remark from bcv_sync where database='db1'  and validation!='successful' and validation='failed' and rownum = 1;

But if in case the db1 validation is failed the query must return the row with failed validation.

Aucun commentaire:

Enregistrer un commentaire