You can set up this example by running:
CREATE TABLE maintable (id INT, choices VARCHAR(255));
INSERT INTO maintable VALUES (1, 'red,green,blue,orange'), (2, 'blue'), (3, ''), (4, 'red,green');
CREATE TABLE othertable (id INT);
INSERT INTO othertable VALUES (1), (2), (3), (4), (5), (6), (7), (8);
You can add a grouping to the above SQL to get a statistical summary:
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(maintable.choices,',',othertable.id),',',-1) AS choice,
COUNT(*) AS numtimes
FROM maintable INNER JOIN othertable ON
(LENGTH(choices)>0 AND SUBSTRING_INDEX(SUBSTRING_INDEX(choices,',',othertable.id),',',-1)
<> SUBSTRING_INDEX(SUBSTRING_INDEX(choices,',',othertable.id-1),',', -1))
GROUP BY choice ORDER BY choice;
http://www.tero.co.uk/scripts/mysql.php
Emmet 進階的 zen coding
Goodbye Zen Coding~ Hello Emmet!
進階的zen coding
offical site
http://emmet.io/
sublime text plugin
https://sublime.wbond.net/packages/Emmet
進階的zen coding
offical site
http://emmet.io/
sublime text plugin
https://sublime.wbond.net/packages/Emmet
Sublime Text 2 在 Windows 7 無法正常顯示簡中, 韓文 解決方安
Windows 8沒有這個問題, 但在Windows 7有這個問題
- 開啟 Sublime text 2 --> Preferences --> Setting -- default
- 找到"font_options": ["directwrite"] 填入 directwrite 存檔即可
http://akr.tw/2012/09/inconsolata-sublime-text-2/
http://shinychang.net/article/5321ad5836bc51c8511b45e9
MySQL database Latin1 to UTF-8
- 以 latin1 匯出資料庫
mysqldump -u root -p --default-character-set=latin1 database > database.sql - 進入 MySQL 以 utf8_general_ci 字元建立資料庫
CREATE DATABASE database_utf8 - 取代匯出資料的內容 SET NAMES latin1 --> SET NAMES utf8
sed -e 's/SET NAMES latin1/SET NAMES utf8/g' database.sql > database_1.sql - 取代匯出資料的內容 CHARSET=latin1 --> HARSET=utf8 COLLATE=utf8_general_ci
sed -e 's/CHARSET=latin1/CHARSET=utf8 COLLATE=utf8_general_ci/g' database_1.sql > database_2.sql - 取代匯出資料的內容 CHARSET=latin1 --> HARSET=utf8 COLLATE=utf8_general_ci
sed -e 's/CHARACTER SET latin1 COLLATE latin1_bin/CHARACTER SET utf8 COLLATE utf8_general_ci/g' database_2.sql > database_3.sql - 匯入資料庫
mysql -u root -p database_utf8 < database_3.sql
匯入資料時遇到錯誤, 像重覆Key值時, 假如不重要的table, 就把INSERT都刪掉.
ERROR 1062 (23000) at line 1891: Duplicate entry '?' for key 1
訂閱:
文章 (Atom)