Re: use of substring()

2002-06-13 Thread Nick Wilson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Nick Wilson declared > You have an error in your SQL syntax near 'desc FROM news ORDER BY date ' at line 1 Ooops, reserved word! Works great ;-) Any way to add something to it like "" or should I do that in my php? Many thanks g

Re: use of substring()

2002-06-13 Thread Nick Wilson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 * and then Julie Meloni declared > Start with position 1. > > SELECT datefield, SUBSTRING(textfield, 1, 30) as description FROM > tablename WHERE id = 2; Hi again Julie and thanks for 'cross list' help! The problem is not that, at least not fir

Re: use of substring()

2002-06-13 Thread MikeParton
should it not be: SELECT date, substring(text,1,30) as string length starts at position "1". substring, therefore, would consider the first character of the string as position 1, not 0. - Original Message - From: "Nick Wilson" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thur

Re: use of substring()

2002-06-13 Thread Keith C. Ivey
On 14 Jun 2002, at 0:03, Nick Wilson wrote: > SELECT date, SUBSTRING(text, 0,30) as description FROM table WHERE id > = '2'; You can't assume that MySQL is like Perl, PHP, or any other language you may be used to. Note this: "For functions that operate on string positions, the first position

Re: use of substring()

2002-06-13 Thread Julie Meloni
Hi - NW> I have a table (for example) with three cols 'id' | 'date' | 'text' NW> I want to return just 'date' and the first 30 chars from 'text' NW> I've tried this sql: NW> SELECT date, SUBSTRING(text, 0,30) as description FROM table WHERE id = NW> '2'; Start with position 1. SELECT datefi