문제

I have a database with one column which is labeled as text. I want to query just a single value from that text column. However, when I write the code in SQLyog, text turns into TEXT, which is apparently related to character types in mysql. I just want to know how I can query the table for a value that is in a column labeled text.

SELECT id, keyword_netword_id, TEXT, match_type, create_date FROM keywords WHERE TEXT LIKE '%medicare supplemental insurance%';

I'm not typing in text as uppercase, it's just that SQLyog automatically turns into upper case.

도움이 되었습니까?

해결책

simple:

SELECT `id`, `keyword_netword_id`, `text`, `match_type`, `create_date` FROM `keywords` WHERE `text` LIKE '%medicare supplemental insurance%';

다른 팁

I get the impression that you'd be better suited with a set typed column rather than text.

http://dev.mysql.com/doc/refman/5.0/en/set.html

EDIT: Unless, you're just asking how to get the whole column... In that case, TEXT is a reserved word in MySQL, you can put back ticks around column names if they have spaces or reserved words:

SELECT id, keyword_netword_id, `text`, match_type, create_date FROM keywords WHERE `text` LIKE '%medicare supplemental insurance%';
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top