select rows where same column values start with string, 2 questions
问题 I'm trying to get multiple sums of rows, each sum has a matching column string value, and all the values have a matching 4 character prefix, but it's not working and I could use some help. Also, would CASE be a more or less costly query on the db? Started with this: $sql = "SELECT col1 FROM table WHERE substr(col1,1,5)='$string'"; $query = mysqli_query($con, $sql); $row = mysqli_fetch_array($query,MYSQLI_ASSOC); $results = $row['col1']; $sum1 = count(array_keys($results,'string1')); $sum2 =