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..

Use a calculated column that sums all your 0/1 columns. Then you can just add WHERE summed > 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..

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"

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.