This topic is locked
[SOLVED]

 Union Query not supported and i don't have mySQL 5.0+

4/9/2008 4:56:34 PM
PHPRunner General questions
P
phpwalker author

i found this in a prior post

Hi,

you can't use UNION in the PHPRunner directly.
As workaround create view in the database and then use it in the project.


I also need to do a union query... but views are not supported untile mySQL 5.0+ i am running 4
any other possible solutions?
karen

A
alang 4/9/2008

What about putting code into "Before SQL query" event. Put a standard query into PHPRunner SQL tab to allow you to set up fields etc (keep PHPR happy), and then rewrite the SQL query in the event with the more complex UNION bits.

P
phpwalker author 4/9/2008

What about putting code into "Before SQL query" event. Put a standard query into PHPRunner SQL tab to allow you to set up fields etc (keep PHPR happy), and then rewrite the SQL query in the event with the more complex UNION bits.


sorry... I'm not following what code (specifically) ?
k

S
swanside 4/10/2008

i found this in a prior post

I also need to do a union query... but views are not supported untile mySQL 5.0+ i am running 4
any other possible solutions?
karen


Do a create view in your database.
Post your tables you need to join.

P
phpwalker author 4/10/2008



Do a create view in your database.
Post your tables you need to join.


Um... once again... I don't have mySQL 5.x ... you cannot do a "view" in 4.x (they are not supported)
the union query would look like this
SELECT

orders.oFirstName,

orders.oID,

orders.oLastName,

orders.oCompany
FROM orders

UNION

SELECT

leads.leadID,

leads.leadFirstName,

leads.leadLastName,

leads.leadCompany

FROM leads
but PHPRunner does not support union queries... and mySQL 4.x does not support views... any other solution?
karen

S
swanside 4/11/2008



Um... once again... I don't have mySQL 5.x ... you cannot do a "view" in 4.x (they are not supported)
the union query would look like this
SELECT

orders.oFirstName,

orders.oID,

orders.oLastName,

orders.oCompany
FROM orders

UNION

SELECT

leads.leadID,

leads.leadFirstName,

leads.leadLastName,

leads.leadCompany

FROM leads
but PHPRunner does not support union queries... and mySQL 4.x does not support views... any other solution?
karen



Cant you try this. Make a field in your orders table like order_no and the same in your leads table, so what I assume, somebody places an order give them a unique number and the leads has the same order_no.

Then you could do this.
SELECT

orders.order_no

orders.oFirstName,

orders.oID,

orders.oLastName,

orders.oCompany,

leads.leadID,

leads.leadFirstName,

leads.leadLastName,

leads.leadCompany

FROM orders

inner join leads

on orders.order_no = leads.order_no

J
Jane 4/11/2008

Karen,
you can replace default SQL query with your one in the Before SQL query event on the Events tab.