[Zope] FW: re: SUBSTRING(string, 1, 4) Was: left(string, n) equivalent (
Jon Franz
jfranz@one.net
19 Jun 2000 22:50:18 +0200
opps... I sent this to zope-admin instead of zope the other day...
> -----Original Message-----
> From: Jon Franz
> Sent: Sunday, June 18, 2000 1:12 AM
> To: 'joelgrimes@hotmail.com'
> Cc: 'zope-admin@zope.org'
> Subject: re: SUBSTRING(string, 1, 4) Was: left(string, n) equivalent
> (newbie q.)
>
> Sorry for the delay in responding.
> This is a sql syntax problem, actually.
> Your later email showed you were trying to do somethign like this:
> SELECT SUBSTRING(desc, 1, 4), foo, bar FROM MyTable
>
> Whenever you use SUBSTRING (and certain other built ins in sql), you must
> use an As clause to name the output field, thus your query could be
> rewritten as:
> SELECT SUBSTRING(desc, 1, 4) As short_desc, foo, bar, FROM MyTable
>
> without the As clause SQL doesnt know what to name the column created (in
> the results set) by the SUBSTRING - and so it dies instead of returning
> data.
>
> >>
> From: "joel grimes" <joelgrimes@hotmail.com>
> To: zope@zope.org
> Subject: [Zope] left(string, n) equivalent (newbie q.)
> Date: Thu, 15 Jun 2000 14:18:40 PDT
>
> Pardon my ignorance, I'm coming from a VB/Access background.
>
> I need to find an equivalent to using left(string, 4) in a zope SQL
> method's
> select query. My SQL book
> says I can use SUBSTRING(string, 1, 4) in a query but no luck. I'm
> connecting to an Access database.
>
> btw - this mail list ROCKS! I've never waited more than 10 minutes for a
> response.
>
> Thanks
> __________________________________________
> <<
_______________________________________________
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 )
---