Re: z mysql problem noted

Chuck Theobald <[email protected]> Fri, 03 Apr 2015 08:27:25 -0700
Newsgroups gmane.comp.web.zope.plone.user
Message-ID <[email protected]>
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,r.name from
projects as p join
bookings as b join
resources as r
where
b.resource_id = r.id and
b.project_id = p.id and
b.start_date > date_add(now(), interval -365 day) and
b.status = 'Approved' and
p.status = 'Approved' and
p.name not like '%LCNI%'  and
r.name like '%Skyra%'
order by p.name


On 04/03/2015 01:01 AM, dieter wrote:
> Chuck Theobald <[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]
> 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/