On Software Engineering
Pages
Database Design
.NET
Regular Expressions
Queue-based System Architecture
Sunday, February 17, 2019
Creating distinct pairs of values from database table
SELECT * FROM tbl1;
A
B
SELECT t1.val, t2.val
FROM tbl1 t1, tbl1 t2;
A A
B A
A B
B B
SELECT t1.val, t2.val
FROM tbl1 t1, tbl1 t2
WHERE t1.val <> t2.val;
B A
A B
SELECT t1.val, t2.val
FROM tbl1 t1, tbl1 t2
WHERE t1.val <> t2.val
AND t1.val < t2.val;
A B
Newer Post
Older Post
Home