dbTalk Databases Forums  

Selecting a substring

comp.databases.mysql comp.databases.mysql


Discuss Selecting a substring in the comp.databases.mysql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Derek Turner
 
Posts: n/a

Default Selecting a substring - 02-07-2011 , 07:25 AM






SELECT * , SUBSTRING( `Reference` , (
LOCATE( "08", `Reference` ) ) AS TRACK
FROM `work`
WHERE `Reference` LIKE "%08-%"

This is giving me a syntax error. What's wrong?

Reply With Quote
  #2  
Old   
Erick T. Barkhuis
 
Posts: n/a

Default Re: Selecting a substring - 02-07-2011 , 07:34 AM






Derek Turner:

Quote:
SELECT * , SUBSTRING( `Reference` , (
LOCATE( "08", `Reference` ) ) AS TRACK
FROM `work`
WHERE `Reference` LIKE "%08-%"

This is giving me a syntax error. What's wrong?
The number of parentheses: 3x'(' and 2x')'

Reply With Quote
  #3  
Old   
Luuk
 
Posts: n/a

Default Re: Selecting a substring - 02-07-2011 , 07:55 AM



On 07-02-11 14:25, Derek Turner wrote:
Quote:
SELECT * , SUBSTRING( `Reference` , (
LOCATE( "08", `Reference` ) ) AS TRACK
FROM `work`
WHERE `Reference` LIKE "%08-%"

This is giving me a syntax error. What's wrong?
you have 3 times a '('
and only 2 times a ')'

--
Luuk

Reply With Quote
  #4  
Old   
Derek Turner
 
Posts: n/a

Default Re: Selecting a substring - 02-07-2011 , 08:14 AM



On Mon, 07 Feb 2011 13:34:16 +0000, Erick T. Barkhuis wrote:

Quote:
Derek Turner:

SELECT * , SUBSTRING( `Reference` , ( LOCATE( "08", `Reference` ) ) AS
TRACK FROM `work`
WHERE `Reference` LIKE "%08-%"

This is giving me a syntax error. What's wrong?

The number of parentheses: 3x'(' and 2x')'
Thanks for the quick response, I looked and looked but couldn't see it

And now I've got the SUBSTRING syntax the right way round it even does
what I want it to do!

Reply With Quote
  #5  
Old   
Bill B
 
Posts: n/a

Default Re: Selecting a substring - 02-07-2011 , 09:06 AM



On 2/7/2011 9:14 AM, Derek Turner wrote:
Quote:
On Mon, 07 Feb 2011 13:34:16 +0000, Erick T. Barkhuis wrote:

Derek Turner:

SELECT * , SUBSTRING( `Reference` , ( LOCATE( "08", `Reference` ) ) AS
TRACK FROM `work`
WHERE `Reference` LIKE "%08-%"

This is giving me a syntax error. What's wrong?

The number of parentheses: 3x'(' and 2x')'

Thanks for the quick response, I looked and looked but couldn't see it

And now I've got the SUBSTRING syntax the right way round it even does
what I want it to do!
The open parens in front of Reference does not have a corresponding
closing parens.

Bill B

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.