Link to home
Start Free TrialLog in
Avatar of drews1f
drews1f

asked on

PHP Union statement has stopped working.

Hello,

I have this UNION statement that was working fine until 2 days ago.

      $debtlistq = "(SELECT * FROM mortgage WHERE mort_application_date IS NOT NULL $month_select $quarter_select $year_select) UNION (SELECT * FROM remortgage WHERE mort_application_date IS NOT NULL $month_select $quarter_select $year_select) UNION (SELECT * FROM b2l WHERE mort_application_date IS NOT NULL $month_select $quarter_select $year_select) ORDER BY mort_application_date DESC";

Each Select statement works fine individually and statements 1 and 2 work fine when UNION. But if UNION any other statement with the 3rd statement i dont get any rows outputted.

Is there a line of code i can use to find out where the error is?
Thanks
AR
ASKER CERTIFIED SOLUTION
Avatar of Ashish Patel
Ashish Patel
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of drews1f
drews1f

ASKER

i had added an extra field to tables mortgage and remortgage and forgot to add it to b2l. I added it to b2l and all is well again :) thanks anyway!

AR
good, so, always have a practice of specifying column names instead of using *. That would be a good standard. Please close the question if your issue is solved.
Avatar of drews1f

ASKER

i will give you the points as you actually had the right answer ish :)