我想弄清楚如何在我的程序中使用 substr 从表中获取适当的数据。
用户选择“字母”“AA”、“AB”、“AC”、“AD”、“AE”或“all”
然后我需要比较“panelID”是否具有我假设使用 substr 的“字母”。
面板 ID 示例:1122AA-0010
$_SESSION['yield'] = "
from (select distinct panelID from DATABASE.TABLE) s, DATABASE.TABLE p
where p.panelID = s.panelID and p.laminationts > '$start_date' and p.laminationts < '$end_date'
group by week(p.laminationts)";
像这样
"where substr(p.panelID,4,2) = substr(s.panelID,4,2) and p.laminationts > '$start_date' and p.laminationts < ..."
最佳答案
另一种选择是使用 LIKE 运算符和 % 通配符。它将找到包含您感兴趣的文本字符串的任何行:
关于php - 我将如何使用 PHP substr?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6026017/