我需要从一个表中获取记录,其中列值将以“某个值”开头,并以“另一个值”结束

时间:2015-11-07 06:36:10

标签: javascript php arrays multidimensional-array

$nqry = mysql_query("select * FROM table_name where column_name BETWEEN 'AlertStopPressed' AND 'AlertStart'");
while($nftc = mysql_fetch_array($nqry)){
    echo $nftc['user_id']." - ".$nftc['alert_detail_id']." - ".$nftc['name']." - ".$nftc['alert_datetime']."<br>";
}

我必须对这些值进行分组。 please see the image for more details

1 个答案:

答案 0 :(得分:0)

select * from table where columnname like 'startvalue%endvalue';

您的查询

$nqry = mysql_query("select * FROM table_name where column_name BETWEEN 'AlertStopPressed' AND 'AlertStart'") and columnname like 'startvalue%endvalue';