Jump to content

[SOLVED] my substring() function does not work


Recommended Posts

I have a table web2_access_log with a field request_uri that always has a uri as such in it:

 

/universe.jpg

/world.jpg

/stunning.jpg

 

I also have a cust database with file_names and email_addresses as such, for example:

 

file_names email_addresses

universe.jpg tom@yahoo.com

world.jpg jackie@hotmail.com

stunning.jpg toni@msn.com

 

I'm trying to get the matches between the data with the following command, and it works if I first manually remove the forward slash from each record in the web2_access_log field (can't do that all day long) , but not if I try to use the following formula.  What am I missing here?

 

SELECT substring( web2_access_log.request_uri

FROM 1 ), cust.file_names, cust.email_addresses

FROM web2_access_log

JOIN cust ON substring(web2_access_log.request_uri

FROM 1) = cust.file_names

 

I'm stumped and would appreciate any help that a guru could might spare.

 

Thanks!

Ver 14.12 Distrib 5.0.67, for debian-linux-gnu (i486) using readline 5.2

 

It turns out that the first recommendation above, which I did try, doesn't work, but the second one did:

 

This is what worked:

 

SELECT SUBSTRING(web2_access_log.request_uri, 2)

 

thanks for the suggestion and help!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.