Frage

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.

War es hilfreich?

Lösung

simple:

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

Andere Tipps

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%';
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top