phql issue

Code:

$query = $this->modelsManager->createQuery("SELECT id,first_name,last_name,contact_email from Contacts where flag=1 UNION ALL SELECT id,first_name,last_name,bounce_email_address from MailchimpImportContacts where flag=1");
$contacts = $query->execute();**

Hello Friends When I used above query getting error such as :

Syntax error, unexpected token IDENTIFIER(UNION), near to ' ALL SELECT id,first_name,last_name,bounce_email_address from MailchimpImportContacts where flag=1', when parsing: SELECT id,first_name,last_name,contact_email from Contacts where flag=1 UNION ALL SELECT id,first_name,last_name,bounce_email_address from MailchimpImportContacts where flag=1 (175)

How to resolve it



33.1k

Hey

This is code below working in phpmyadmin yet ?

SELECT id,firstname,lastname,contact_email from Contacts where flag=1 UNION ALL SELECT id,first_name,lastname,bounceemail_address from MailchimpImportContacts where flag=1


5.0k

Hey

This is code below working in phpmyadmin yet ?

```php SELECT id,firstname,lastname,contactemail from Contacts where flag=1 UNION ALL SELECT id,firstname,lastname,bounceemail_address from MailchimpImportContacts where flag=1 ```

Yes I know but not working in phalcon when I try to execute.



5.0k

Syntax error, unexpected token IDENTIFIER(UNION), near to ' SELECT id,firstname,lastname,bounceemailaddress from MailchimpImportContacts where flag=1', when parsing: SELECT id,firstname,lastname,contactemail from Contacts where flag=1 UNION SELECT id,firstname,lastname,bounceemail_address from MailchimpImportContacts where flag=1 (196)

UNION is probably not supported in PHQL yet :/



5.0k

What is alternative method for it?

I use Raw SQL: http://docs.phalconphp.com/en/latest/reference/phql.html#using-raw-sql but i can't receive data How to use using-raw-sql and receive data? thanks.