I want to do a select in MySql that combines several columns... something like this pseudocode:
SELECT payment1_paid AND payment2_paid AS paid_in_full
FROM
SELECT IF(payment1_paid = 1 AND payment2_paid = 1, 1, 0) AS paid_in_fill
I am not sure but do you mean to concatenate?
SELECT CONCAT(ColumnA, ColumnB) AS ColumnZ
FROM Table
Ok, for logical and you can do
Select (payment1_paid && payment2_paid) as paid_in_full
from denormalized_payments
where payment1_type = 'check';
As seen here.
If by combine you mean concatenate then this will work:
select concat(payment1_paid, payment2_paid) as paid_in_full
from denormalized_payments where payment1_type = 'check';
If by combine you mean add, then this should work:
select payment1_paid + payment2_paid as paid_in_full
from denormalized_payments where payment1_type = 'check';
[EDIT]
For boolean AND:
select payment1_paid && payment2_paid as paid_in_full
from denormalized_payments where payment1_type = 'check';
Just do
Select CONCAT(payment1_paid, payment2_paid) as paid_in_full
from denormalized_payments
where payment1_type = 'check';
You can concat any number of field you want.
select (payment1_paid && payment2_paid) as paid_in_full
from denormalized_payments where payment1_type = 'check';