mysql - Select query which give those rows having two or more than two non-zero values -
I have a MySQL table that contains 8 columns (id, user, A, B, C, D, E, F) and
id user ABCDEF 1 0001 0 0 0 2 0002 0 5 8 4 6 5 3 0003 0 0 0 5 4 0004 2 6 4 5 4 1 5 0005 1 0 0 6 6 0006 7 6 5 4 0 9 7 0007 4 0 0 8 8] I want to select a MySQL query which lists those users with two or more non-zero values. Therefore the query must return the record id (2,4,6,7) Thanks
Another way to do this is by
select * Where T (+> <+ 0) + (B> <+ 0) + (c & lt; & gt; +) + (D> <); (< 0) + (F <> 0)); = 2 Gives the boolean (0/1) value equal to the operator against the criteria and you can add the results of each column and terminate the records according to your criteria
Comments
Post a Comment