Page 1 of 1

MySQL selection...

Posted: Tue May 31, 2005 8:04 pm
by Todd_Z
If i am selecting fields from a table, but for example, some are

index.php?pg=2334, some are index.php?pg=2334&PHPSESSID=WHATEVER

Code: Select all

$sql = "SELECT `Page`, COUNT(`Page`) FROM `Visitors` GROUP BY `Page`";
Returns each with their respective counts.
However, I want to be able to split off the PHPSESS so that equal pages with a phpsessid count as the same. Can i remove the phpsess in the sql string?

Posted: Tue May 31, 2005 8:39 pm
by hawleyjr
MySql has a bunch of String functions.

http://dev.mysql.com/doc/mysql/en/string-functions.html

Check out the following:
SUBSTRING_INDEX
SUBSTRING
POSITION