[Zope] re: SQL Unions.

Marcus Collins mcollins@sunesi.com
Tue, 18 Jan 2000 11:51:56 +0200


MySQL does not currently support UNION; it is on their to do list.

You'll have to "fake" it somehow, maybe by doing a select on both tables and
putting the result into a master list, or by settling for selecting the two
in separate columns  (select tableofitemsoftype1.brand AS brand1,
tableofitemsoftype2.brand AS brand2 ...) and then put the results into a
master list. Or, if the data is static, just make a master table containing
the data from tableofitemsoftype1 and tableofitemsoftype2.

-- Marcus


> -----Original Message-----
> From: Brenton Bills [mailto:fud@mail.theinternet.com.au]
> Sent: 17 January 2000 23:47
> To: zope@zope.org
> Subject: [Zope] re: SQL Unions.
> 
> 
> 
> Hi people,
> 	I have been attempting to do an SQL union from an ZSQL 
> Method with
> MysqlDA as my back end database. The only problem is I cant 
> seen to get it
> to work.
> 
> Are unions a bad thing? Should I be using something else.
> 
> Eg. Get all the brands we have in our database.
> 
> select brand
> from tableofitemsoftype1
> union
> select brand
> from tableofitemsoftype2
> group by brand.
> 
> From what I understand this would get all of the brands and group them
> together and place them in a single column results table? 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>