How to UNION two queries to make a Fabrik list?

bascherz

Member
Hi all,

I have these two queries that, when issued like this in mysql, provide me the absolutely perfect result.

Code:
select r.* from requests r join zipcodes z join district_names d on r.zip=z.zip and z.district=d.id where d.lead={$my->id}
union
select r.* from requests r join zipcodes z join district_names d join comprofiler c on c.cb_zip=z.zip and c.user_id=r.matchuser and z.district=d.id where d.lead={$my->id}

The first query yields all the records from the requests table that have a zip code for which the current user is the lead.

The second query is similar and yields all the records from the requests table that have a matchuser whose profile cb_zip matches one where the current user is the lead.

The union returns no duplicate requests records even though the two queries executed separately yield 32 duplicate records. The union is literally perfect.

So, how do I do this in Fabrik for my list? Do I create two lists and somehow union them? Or is there a way to do all of the above to define a single list? I'm probably over-thinking this if I know me (sometimes I am not sure if I do!).

Thanks in advance,
Bruce
 
For whatever can't be done with Fabrik tools such as list pre-filters, merging records etc, I'd create a MySQL view in phpMyAdmin and a Fabrik list for that view.
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top