can anyone let me know if there is a way (using a SQL statement) that I can extract a substring of data from a text field. we hold referrer data in a table and I need to extract several parameters from the referring url e.g. domain name, search query etc. At the moment the referring url is one field within the database table and holds all of the referrer url data - I just need to extract substrings of this url and there is no fixed format to the url that is stored in the database. I need to be able to do this with SQL statements rather than through a php script or similar. we are using mysql Thanks a lot.
If you want to extract a substring, you have several ways : 1) the SUBSTRING function use and examples here : http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring 2) SUBSTRING_INDEX function http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_substring-index 3) For powerful searches, use REGEXP you'll find a lot of examples searching regexp on google... Give a detailed example of what you want if you need more help Hope this will help you