【发布时间】:2017-01-06 05:28:57
【问题描述】:
一个表名player在表中有一些列和数据如下:
**PID**|**PNAME**|**CITY**|**TEAM**|**SALARY**|**NO_OF_PENALTIES**
1001 ozil istanbul germany 500000 1
1002 messi madrid arsenal 500000 2
1003 ronaldo manc uk 600000 1
1004 puyol sussex germany 400000 3
1005 fabregas manchester uk 450000 2
1006 costa ankara turkey 400000 3
1007 beckham london uk 600000 2
这是表格。如果团队名称为“germany”& no_of_penalties=1 则我想记录查询。如果团队名称为“uk”& no_of_penalties=2 则我不想要获取记录。 意思是根据上面的记录按照查询我想得到pid=1001&pid=1003的记录。 但是当我编写如下所示的查询时:
select * from player where (team='germany' and no_of_penalties=1) or not (team='uk' and no_of_penalties=2) and team in ('germany','uk');
然后在执行上述查询后,输出看起来像 pid=1001, 1003, 1004 如下所示
**PID**|**PNAME**|**CITY**|**TEAM**|**SALARY**|**NO_OF_PENALTIES**
1001 ozil istanbul germany 500000 1
1003 ronaldo manc uk 600000 1
1004 puyol sussex germany 400000 3
那么你能帮我解决这个问题吗?
【问题讨论】:
-
根据您的要求回答正确
标签: sql oracle plsql plsqldeveloper