Re: z mysql problem noted

Chuck Theobald <[email protected]> Fri, 03 Apr 2015 08:59:08 -0700
Newsgroups gmane.comp.web.zope.plone.user
Message-ID <[email protected]>
Yes! That works! It also works in the cli of mysql. mysql seems to not 
have a problem with column headings being the same string, z sql seems 
to balk at this.

Thanks, Daniel.

Chuck


On 04/03/2015 08:41 AM, Daniel Fimiarz wrote:
> Not sure how to replay to the entire list.
>
> Would that work?
>
> select distinct p.name <http://p.name/> *AS proj_name*,r.name 
> <http://r.name/>*AS book_name* from
> projects as p join
> bookings as b join
> resources as r
> where
> b.resource_id = r.id <http://r.id/> and
> b.project_id = p.id <http://p.id/> and
> b.start_date > date_add(now(), interval -365 day) and
> b.status = 'Approved' and
> p.status = 'Approved' and
> p.name <http://p.name/> not like '%LCNI%'  and
> r.name <http://r.name/> like '%Skyra%'
> order by p.name <http://p.name/>
>
> On Fri, Apr 3, 2015 at 11:27 AM, Chuck Theobald <[email protected] 
> <mailto:[email protected]>> wrote:
>
>     Sorry for the missing image, should have posted text at first anyway.
>     Thank you, Dieter for posting in the face of ambiguity :-)
>
>     As seen in the query below, I am using the sql "as", but z sql
>     seems to
>     not recognize this.
>
>     Error, : Duplicate column name, name SQL used:
>
>     select distinct p.name <http://p.name>,r.name <http://r.name> from
>     projects as p join
>     bookings as b join
>     resources as r
>     where
>     b.resource_id = r.id <http://r.id> and
>     b.project_id = p.id <http://p.id> and
>     b.start_date > date_add(now(), interval -365 day) and
>     b.status = 'Approved' and
>     p.status = 'Approved' and
>     p.name <http://p.name> not like '%LCNI%'  and
>     r.name <http://r.name> like '%Skyra%'
>     order by p.name <http://p.name>
>
>
>     On 04/03/2015 01:01 AM, dieter wrote:
>     > Chuck Theobald <[email protected] <mailto:[email protected]>>
>     writes:
>     >> ...
>     >>      I ran into an odd issue with a z sql method, plone is claiming
>     >>      duplicate column names, see image below.
>     > I cannot see you image. Likely, you get an exception and
>     > in all those cases, you should post the detailed error description
>     > you find in your "error_log" object for that exception.
>     >
>     >
>     > Not seeing your image, I can only guess:
>     > the interface "Z SQL Method"s present towards the application
>     > is name based -- i.e. the result fields have names.
>     > The basic SQL interface is not name based but position based.
>     > Auxiliary names are derived from column names or SQL expressions
>     > *BUT* SQL does do not garantee that those names are unique.
>     > It is quite possible that SQL assigned the same name to different
>     > field positions in the result and than the "Z SQL Method" does
>     > not know which value it should use for its single name -- and
>     complains.
>     > In those cases use the SQL "as" to garantee the associated field
>     names
>     > in the result become distinct.
>     >
>     >
>     >
>     >
>     ------------------------------------------------------------------------------
>     > Dive into the World of Parallel Programming The Go Parallel
>     Website, sponsored
>     > by Intel and developed in partnership with Slashdot Media, is
>     your hub for all
>     > things parallel software development, from weekly thought
>     leadership blogs to
>     > news, videos, case studies, tutorials and more. Take a look and
>     join the
>     > conversation now. http://goparallel.sourceforge.net/
>     > _______________________________________________
>     > Plone-Users mailing list
>     > [email protected]
>     <mailto:[email protected]>
>     > https://lists.sourceforge.net/lists/listinfo/plone-users
>
>     --
>     Chuck Theobald
>     System Administrator
>     The Robert and Beverly Lewis Center for Neuroimaging
>     University of Oregon
>     P: 541-346-0343 <tel:541-346-0343>
>     F: 541-346-0345 <tel:541-346-0345>
>
>
>     ------------------------------------------------------------------------------
>     Dive into the World of Parallel Programming The Go Parallel
>     Website, sponsored
>     by Intel and developed in partnership with Slashdot Media, is your
>     hub for all
>     things parallel software development, from weekly thought
>     leadership blogs to
>     news, videos, case studies, tutorials and more. Take a look and
>     join the
>     conversation now. http://goparallel.sourceforge.net/
>     _______________________________________________
>     Plone-Users mailing list
>     [email protected]
>     <mailto:[email protected]>
>     https://lists.sourceforge.net/lists/listinfo/plone-users
>
>

-- 
Chuck Theobald
System Administrator
The Robert and Beverly Lewis Center for Neuroimaging
University of Oregon
P: 541-346-0343
F: 541-346-0345

------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/

_______________________________________________
Plone-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/plone-users