Calimeron wrote:
> Chinese Char. No. Chinese Char. English Def. No. English Def.
> 1 Char1 1 Def1
> 2 Char2 2 Def2
> 2 Char2 3 Def3
> 3 Char3 4 Def4
> 4 Char4 5 Def5
> 4 Char4 6 Def6
> 5 Char5 7 Def7
>
> Can this be done?
What you want is called a "join".
[hudson:~] $ sqlite3
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table chChar(id INTEGER PRIMARY KEY, char TEXT);
sqlite> create table englCharDefn(id INTEGER PRIMARY KEY, chChar REFERENCES
chChar, defn TEXT);
sqlite> INSERT INTO chChar VALUES(null, 'char1');
sqlite> INSERT INTO chChar VALUES(null, 'char2');
sqlite> INSERT INTO chChar VALUES(null, 'char3');
sqlite> INSERT INTO chChar VALUES(null, 'char4');
sqlite> INSERT INTO chChar VALUES(null, 'char5');
sqlite> INSERT INTO englCharDefn VALUES(null, 1, 'def1');
sqlite> INSERT INTO englCharDefn VALUES(null, 2, 'def2');
sqlite> INSERT INTO englCharDefn VALUES(null, 2, 'def3');
sqlite> INSERT INTO englCharDefn VALUES(null, 3, 'def4');
sqlite> INSERT INTO englCharDefn VALUES(null, 4, 'def5');
sqlite> INSERT INTO englCharDefn VALUES(null, 4, 'def6');
sqlite> INSERT INTO englCharDefn VALUES(null, 5, 'def7');
sqlite> select chChar.id, chChar.char, englCharDefn.id, englCharDefn.defn from
englCharDefn join chChar ON (englCharDefn.chChar = chChar.id);
1|char1|1|def1
2|char2|2|def2
2|char2|3|def3
3|char3|4|def4
4|char4|5|def5
4|char4|6|def6
5|char5|7|def7
--
Eric A. Smith
I still maintain the point that designing a monolithic kernel in
1991 is a fundamental error. Be thankful you are not my student.
You would not get a high grade for such a design.
-- Andrew Tanenbaum, to Linus Torvalds
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users