From 9ceb237dd6779e58047d112d051ab28b1002eb92 Mon Sep 17 00:00:00 2001 From: Deven Bansod Date: Wed, 5 Oct 2016 17:38:23 +0530 Subject: [PATCH] Don't append FROM clause for replacing in UNION statements If global statement has atleast one union, it should not have a FROM. Fix #12619 Signed-off-by: Deven Bansod --- tbl_export.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tbl_export.php b/tbl_export.php index 542dfd9c84..740e2249fa 100644 --- a/tbl_export.php +++ b/tbl_export.php @@ -67,7 +67,9 @@ if (! empty($sql_query)) { } // Rebuilding the SELECT and FROM clauses. - if (count($parser->statements[0]->from) > 0) { + if (count($parser->statements[0]->from) > 0 + && count($parser->statements[0]->union) === 0 + ) { $replaces = array( array( 'FROM', 'FROM ' . SqlParser\Components\ExpressionArray::build(