Page 1 of 1

Relationships::UNION

PostPosted: Fri Aug 19, 2011 11:05 am
by barryrs
Hope you're ready for a wonderful weekend!!

Tried something today: I set the following as a relationship of the clients table.. it wasn't happy:) any thoughts?
I may try setting it up as a view instead... Thanks again! and I hope you do have a great weekend!! -Baer

__sql__ = "SELECT * FROM `transaction` WHERE ClientsID= '$ClientsID' UNION SELECT * FROM `transHistory` WHERE ClientsID= '$ClientsID'"

Re: Relationships::UNION

PostPosted: Mon Aug 22, 2011 1:47 pm
by shannah
The relationship SQL parser is getting better all the time, but in general it still likes it to be simple. E.g. a join, maybe a double join... but not unions etc... This is partly because it has difficulty knowing how to insert records into a union.

If it is a read-only relationship then theoretically this type of functionality could be developed.... but the parser doesn't currently support unions.

What I generally do in a case like this is create a view with exactly what I want (i.e. the union would be part of the view definition). Then I use that view in the relationship.

-Steve