SELECT t1.case_num AS casenum, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL
FROM luponcase_tbl t1
WHERE t1.case_num = :id AND t1.status = :active
UNION
SELECT mhearing_number, mhearing_status, mhearing_number, NULL, NULL, NULL, NULL, NULL,
NULL, NULL
FROM luponcase_mediation_tbl t4
WHERE t4.case_num = :id AND t4.status = :active
UNION
SELECT mfileblob, mfile_type, mfilesize, mhearing_number, mnameoffile, NULL, NULL, NULL,
NULL, NULL
FROM luponcase_mediation_reference_tbl t5
WHERE t5.case_num = :id AND t5.status = :active
This is my sql for union and i am not getting result so i tried to echo the result
while ($selected_row = $stmt->fetch(PDO::FETCH_ASSOC)) {
print_r($selected_row);
}
to my surprise the result is
Array ( [casenum] => 14 [NULL] => )
I am assuming that the first value is ok then the NULL
columns are not. How to make it in a way that i will get only the columns except the NULL
ones.