1
我有下表。在mysql中搜索字數查詢
CREATE TABLE IF NOT EXISTS `product`
(
`id` int(11) NOT NULL,
`name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`description` varchar(200) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `product` (`id`, `name`, `description`) VALUES
(1, 'Samsung', "this is samsung product description from samsung"),
(2, 'Mobile', "Samsung galaxy note2 from samsung store"),
(3, 'Smartphone', "Samsung");
現在我想查詢產生如下結果的product
表。
ID Name WordCount
1 Samsung 3
2 Mobile 2
3 Smartphone 1
我怎樣才能算出這個詞出現在MySQL
選擇查詢。
編輯
對不起,不清除我的觀點。
但是在這裏。
我想search
字Samsung
從所有的行,並計算它的出現不僅從名稱,也從描述也。
http://stackoverflow.com/questions/748276/using-sql-to-determine-word-count的可能的複製-stats-of-text-field – 2013-04-11 08:11:24
@JacobTomlinson請參閱我的編輯...請 – 2013-04-11 08:27:31
我認爲'雅各布湯姆林森的參考是正確的。它可能不是完全相同的,但它指向了正確的方向。 ''正確的方法是處理數據庫以外的數據,因爲數據庫用於存儲,而不是處理......' – Ejaz 2013-04-11 08:34:34