我在下面的语句
中遇到了mysql中的一些问题import { FlexLayoutModule } from '@angular/flex-layout';
@NgModule({
import:[
FlexLayoutModule
])}
此声明工作正常,但以下声明无效,
make_request (int major, int rw, struct buffer_head *bh)
{
struct request *req;
int rw_ahead;
if (rw_ahead = (rw == READA || rw == WRITEA))
{
if (bh->b_lock)
return;
if (rw == READA)
rw = READ;
else
rw = WRITE;
}
if (rw != READ && rw != WRITE)
panic ("Bad block dev command, must be R/W/RA/WA");
lock_buffer (bh);
if ((rw == WRITE && !bh->b_dirt) || (rw == READ && bh->b_uptodate))
{
unlock_buffer (bh);
return;
}
repeat:
if (rw == READ)
req = request + NR_REQUEST;
else
req = request + ((NR_REQUEST * 2) / 3);
/* find an empty request */
while (--req >= request)
if (req->dev < 0)
break;
if (req < request)
{
if (rw_ahead)
{
unlock_buffer (bh);
return;
}
sleep_on (&wait_for_request);
goto repeat;
}
req->dev = bh->b_dev;
req->cmd = rw;
req->errors = 0;
req->sector = bh->b_blocknr << 1;
req->nr_sectors = 2;
req->buffer = bh->b_data;
req->waiting = NULL;
req->bh = bh;
req->next = NULL;
add_request (major + blk_dev, req);
}
在终端显示QUERY OK,0行受影响
答案 0 :(得分:0)
您需要子查询中actorid
列的表别名:
delete from actors
where not exists (select 1 from movies z where z.actorid = actors.actorid );
否则,actorid
会解析为z.actorid
。
答案 1 :(得分:0)
查询select 1 from movies z where z.actorid = actorid
,单独站立,为1
表格的每一行都会为movies
生成一个结果集。为什么? where z.actorid = actorid
与where z.actorid = z.actorid
相同,后者与where 1 = 1
相同,是一个接受所有行的无操作过滤器子句。
NOT EXISTS(that result set)
中有任何行, movies
始终为false。
所以你的delete
子句看起来像delete from actors where not exists (select 1)
:where
子句总是错误的。因此delete
查询在零行上运行。
你如何解决这类问题?