/* Create a table called tbl1 */
CREATE TABLE tbl1(id integer PRIMARY KEY, name text, lang text);
/* Create few records in this table */
INSERT INTO tbl1 VALUES(1,'John', 'Perl');
INSERT INTO tbl1 VALUES(2,'Pete', 'Perl');
INSERT INTO tbl1 VALUES(3,'Sam', 'Java');
INSERT INTO tbl1 VALUES(4,'John', 'Php');
INSERT INTO tbl1 VALUES(5,'Sam', 'Perl');
INSERT INTO tbl1 VALUES(6,'Sam', 'Php');
INSERT INTO tbl1 VALUES(7,'Pete', 'C');
INSERT INTO tbl1 VALUES(8,'Bob', 'Java');
派生知道Perl和Php的人的名字。如何使sql(postgresql)查詢?
你有嘗試過什麼嗎? –
首先,規範化你的數據... –
從數據透視到半哈希將會有大約20-30個可行的答案。這似乎是作業,但你應該嘗試學習一個答案。 – Twelfth