[英]Selecting multiple mysql columns
I cannot figure out how to select multiple columns and a comma separated column. 我不知道如何选择多个列和一个逗号分隔的列。
I have: 我有:
Table: example_tbl
| amount | recurring | frequency |
| 100 | 150 | 8,monthly |
| 200 | 250 | 1,annually |
The problem seems to be with the frequency and the comma. 问题似乎出在频率和逗号上。 I tried:
我试过了:
$q = mysql_query("SELECT amount, recurring FROM example_tbl WHERE id=".$item['relid']." LIMIT 1" AND * FROM example_tbl WHERE FIND_IN_SET ('monthly', frequency));
Any help would be appreciated. 任何帮助,将不胜感激。
The problem has nothing to do with the comma, your SQL syntax is just wrong. 问题与逗号无关,您的SQL语法错误。 Connect all the conditions in a single
WHERE
clause using AND
. 使用
AND
在单个WHERE
子句中连接所有条件。
$q = mysql_query("SELECT amount, recurring, frequency
FROM example_tbl
WHERE id=".$item['relid']."
AND FIND_IN_SET ('monthly', frequency)
LIMIT 1");
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.