1. p1 | cat | mause
2. p2 | mause | cat
Hello, I d like to select 2 records form database with condition. My query:
SELECT * FROM mytable
WHERE (p1 LIKE cat OR p2 LIKE cat) AND (p1 LIKE mause OR p2 LIKE mause)
面对这一困难,它将选择两行,选择每一行“目录”和“用途”,这是一个问题,因为我只想选择第一行,因为首先我选择“目录”,然后在第3页是“用途”。
在第二行“用途”为第1栏,因此选择这一行次,因为“散射”为“用途”。
<>>>>>>>>>> >>>>> >> >> > > >_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_>_ SOME UPDATES to MY <>>>>>_ _ <>_>_>_>_>_>_>_>_>_>_>_>_>
如下: 我在数据库中表格的例子。 所有记录都作为VARCHAR被淡化。 我必须写上链接,因为我对 st流的声望很低,我可以在这里打下形象。
我想选择从拉斯维加斯到芝加哥的路线。 但是,当我这样问:
SELECT * FROM mytable
WHERE (station1 LIKE Las Vegas OR station2 LIKE Las Vegas OR station3 LIKE Las Vegas) AND (station1 LIKE Chicago OR station2 LIKE Chicago OR station3 LIKE Chicago)
它将选择所有包含Las Vegas和芝加哥的行文,但我不想选择芝加哥首先在数据库中的位置。 我只想选择Las Vegas在坐桌前在芝加哥的这条路线。 因此,这只是第一行“第一行”。
在“Las Vegas”号站(Las Vegas号站,第3号,芝加哥站2号)之后,我不想,第3行也是如此。
我认为,现在大家都很清楚。