Hi all,
I'm trying to use UNION ALL to match three SELECT queries. Each query has 8 column names but for some reason it fails when I use a particular group of column names. Namely the 7th column names in the queries below (ad_credit_amount in the first two SELECT queries and transaction_amount in the third SELECT query).
In mysql these both of these columns are set as VARCHAR(200) and utf-8 unicode. They contain numbers that include decimal places.
This is really confusing me because the other columns are working fine with similar data. Do you have any ideas what may be causing this failure as I've run out of ideas (and it's just gone 4am here in the uk! 😃 )
Cheers!
Stu
$sql = "select * from
(
(
(
SELECT ad_timestamp,ad_number,ad_location,ad_category_number,ad_title,
ad_fee_amount, ad_credit_amount, ad_account_ballance
FROM ads_live WHERE
(
ad_account_username = '$_SESSION[account_username]'
AND
ad_website = 'hr'
)
)
UNION ALL
(
SELECT ad_timestamp,ad_number,ad_location,ad_category_number,ad_title,
ad_fee_amount, ad_credit_amount,ad_account_ballance
FROM ads_not_live WHERE
(
ad_account_username = '$_SESSION[account_username]'
AND
ad_website = 'hr'
)
)
UNION ALL
(
SELECT transaction_timestamp, transaction_number, transaction_account_username,
transaction_iso_currency, transaction_credit_card_number, transaction_website
,transaction_amount, transaction_blank1
FROM transactions WHERE
(
transaction_account_username = '$_SESSION[account_username]'
AND
transaction_website = 'hr'
)
)
ORDER BY 1 LIMIT $lowest_rank_on_page,$account_list_length
)
)
as a order by 1 DESC";