f**c 发帖数: 629 | 1 I am new to database. Could any one help on this easy query? Thanks alot.
Given the following SQL table:
create table myTable (
id int not null,
val varchar(2) not null
);
With values:
id val
-------
1 b
2 c
3 a
4 b
5 c
Write a single SQL query in MySQL 3.23 which will output the
following result, which is a list of records with equal 'val'
fields:
+-----+-----+-----+
|
w****t 发帖数: 33 | 2 self join
【在 f**c 的大作中提到】 : I am new to database. Could any one help on this easy query? Thanks alot. : Given the following SQL table: : create table myTable ( : id int not null, : val varchar(2) not null : ); : With values: : id val : ------- : 1 b
|
s***c 发帖数: 1926 | 3 self join 怎么把重复行去掉啊
1 4 b
4 1 b
2 5 c
5 2 c
【在 w****t 的大作中提到】 : self join
|
c*******e 发帖数: 8624 | 4 where a.id < b.id
【在 s***c 的大作中提到】 : self join 怎么把重复行去掉啊 : 1 4 b : 4 1 b : 2 5 c : 5 2 c
|
s***c 发帖数: 1926 | 5 ft,我写了个 a.id<>b.id,然后对着屏幕发了10分钟的呆。
【在 c*******e 的大作中提到】 : where a.id < b.id
|