Monkuar Posted July 30, 2012 Share Posted July 30, 2012 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. Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted July 30, 2012 Share Posted July 30, 2012 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 Quote Link to comment Share on other sites More sharing options...
Monkuar Posted July 30, 2012 Author Share Posted July 30, 2012 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 Quote Link to comment Share on other sites More sharing options...
Monkuar Posted July 30, 2012 Author Share Posted July 30, 2012 WOW!! NO QUOTES!! LOL AND SUBSTRING_INDEX(last_post, '|', 1) >= 1 THANK YOU!! Marked as resolved! Love how the help document doesn't say anything about that, stupid site ! Quote Link to comment Share on other sites More sharing options...
Pikachu2000 Posted July 30, 2012 Share Posted July 30, 2012 It's well documented that database, table and field names are never enclosed in quotes; only strings are. There's really no need to repeat it in the documentation for each and every function in the manual. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.