clear markdown compare help best fiddles feedback dbanow.uk a leap of faith?
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 984296 fiddles created (11692 in the last week).

CREATE TABLE pingyin_word(word varchar(20), word_pingyin varchar(20), word_pingyin_order varchar(20), words varchar(20),bank_id varchar(20));
 hidden batch(es)


INSERT INTO pingyin_word values ('勝','ㄕㄥˋ','4','聊勝一籌','1');
 hidden batch(es)


INSERT INTO pingyin_word values ('勝','ㄕㄥˋ','4','勝券在握','1');
 hidden batch(es)


INSERT INTO pingyin_word values ('勝','ㄕㄥˋ','4','名勝美景','1');
 hidden batch(es)


INSERT INTO pingyin_word values ('勝','ㄕㄥ','1','悲不自勝','1');
 hidden batch(es)


INSERT INTO pingyin_word values ('勝','ㄕㄥ','1','不勝枚舉','1');
 hidden batch(es)


INSERT INTO pingyin_word values ('勝','ㄕㄥ','1','喜不自勝','1');
 hidden batch(es)


SELECT * FROM pingyin_word;
word word_pingyin word_pingyin_order words bank_id
ㄕㄥˋ 4 聊勝一籌 1
ㄕㄥˋ 4 勝券在握 1
ㄕㄥˋ 4 名勝美景 1
ㄕㄥ 1 悲不自勝 1
ㄕㄥ 1 不勝枚舉 1
ㄕㄥ 1 喜不自勝 1
 hidden batch(es)


SELECT CONCAT(word, CASE WHEN word_pingyin_order='1' THEN '(一)' WHEN word_pingyin_order='2' THEN '(二)' WHEN word_pingyin_order='3' THEN '(三)' WHEN word_pingyin_order='4' THEN '(四)' ELSE '*' END, word_pingyin) AS wordcombineA, GROUP_CONCAT(words) AS wordcombineB FROM pingyin_word WHERE 1=1 AND bank_id='1' GROUP BY word,word_pingyin,word_pingyin_order ORDER BY word,word_pingyin,word_pingyin_order,words
wordcombineA wordcombineB
勝(一)ㄕㄥ 悲不自勝,不勝枚舉,喜不自勝
勝(四)ㄕㄥˋ 聊勝一籌,勝券在握,名勝美景
 hidden batch(es)