Jump to content

SUBSTRING_INDEX not working


Monkuar

Recommended Posts

Code:

 

WHERE num_posts > 20 AND SUBSTRING_INDEX('last_post', '|', 1) > 1

 

IM trying to select my first explode in my last_post column.

 

last_post value =

1342545240|614|11890|Find The Religion Forums So...

 

I am trying to select where num_posts >20 AND last_post > 1343622791

 

 

The query shows no errors, but no results.  Please help, Thanks

 

"1343622791" will stand for whatever timestamp I want to be queried by.  1343622791 Is just an example.

 

 

Link to comment
Share on other sites

Column names are not enclosed within single-quotes. SUBSTRING_INDEX('last_post', '|', 1) is trying to find the | character within the literal string last_post

 

Hmm.. so how can I get the value of my last_post column to get SUBSTRINGED?

 

So If it's finding the literal "last_post" that's not good, lol.  I need it to explode through my last_post column I'm assuming.

 

http://dev.mysql.com/doc/refman/5.5/en/string-functions.html#function_substring

 

this one seems like it would work but no delimiter?

Also, I closed them with " quotes, still no results but no errors? So weird

 

Link to comment
Share on other sites

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.