0

This is how my license table look like.. i want to select only row that has atleast one "1".
which means i don't want to select any row that has full of zeros..

Edited by fire eaters: n/a

Attachments ggg.PNG 9.79 KB
2
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by pritaeas
0

Use a calculated column that sums all your 0/1 columns. Then you can just add WHERE summed > 0

you mean a calculated colum as an alias right. give me an idea to summ all 0/1..

0

SUM(column1, column2, ...) or just column1 + column2 + ...

SELECT 
sum(F1)+sum(F2)+sum(F3)+sum(F4)+sum(F5)+sum(F6)+sum(F7)+sum(F8)+
sum(A)+sum(A1)+sum(B)+sum(B1)+sum(B2)+sum(C)+sum(C1)+sum(C2)+sum(V1)
as total
FROM `licence` 
WHERE total> 0

the error says unknown column total. my idea is to select rows that atleast have one "1"

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.