不使用ORM,如何将NOT IN子查询附加到SELECT查询?
public function testFoo()
{
$faker = Faker\Factory::create();
$response = $this->call('POST', route('make.foo'), [
'content' => $faker->text(200),
]);
$response->assertRedirect('/');
}
使用Python:
public class Alpha_Loop extends AppCompatActivity {
ImageView abc,img1;
int i = 0;
int ab;
int playsound;
Runnable Rn;
int s = 0;
long updatetime;
MediaPlayer mediaPlayer;
Handler handler;
//Array of Image1
final int[] ImageArray = {R.drawable.a, R.drawable.a, R.drawable.b, R.drawable.c, R.drawable.d, R.drawable.e,
R.drawable.f, R.drawable.g, R.drawable.h, R.drawable.i, R.drawable.j, R.drawable.k,
R.drawable.l, R.drawable.m, R.drawable.n, R.drawable.o, R.drawable.p, R.drawable.q,
R.drawable.r, R.drawable.s, R.drawable.t, R.drawable.u, R.drawable.v, R.drawable.w,
R.drawable.x, R.drawable.y, R.drawable.z};
//Array of Image1
final int[] img1Array = {R.drawable.apple, R.drawable.ball, R.drawable.cat, R.drawable.dog, R.drawable.egg,
R.drawable.fish, R.drawable.goat, R.drawable.hat, R.drawable.insect, R.drawable.jar,
R.drawable.king, R.drawable.leaf, R.drawable.monkey, R.drawable.nose, R.drawable.ocean,
R.drawable.parrot, R.drawable.queen, R.drawable.rat, R.drawable.sun, R.drawable.tap,
R.drawable.umbrella, R.drawable.violin, R.drawable.well, R.drawable.box, R.drawable.yatch,
R.drawable.zebra};
//Array of wav files
final int[] Soundid = {R.raw.a, R.raw.a, R.raw.b, R.raw.c, R.raw.d, R.raw.e,
R.raw.f, R.raw.g, R.raw.h, R.raw.i, R.raw.j, R.raw.k,
R.raw.l, R.raw.m, R.raw.n, R.raw.o, R.raw.p, R.raw.q,
R.raw.r, R.raw.s, R.raw.t, R.raw.u, R.raw.v, R.raw.w,
R.raw.x, R.raw.y, R.raw.z};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.alpha__loop);
abc = findViewById(R.id.abc);
img1 = findViewById(R.id.img1);
aa();
}
public void aa(){
final Handler handler = new Handler();
Rn = new Runnable() {
@Override
public void run() {
abc.setImageResource(ImageArray[ab]);
ab++;
if (i == ImageArray.length) {
i = 0;
}
img1.setImageResource(img1Array[i]);
i++;
if (i == img1Array.length) {
i = 0;
}
playsound = Soundid[s];
mediaPlayer = MediaPlayer.create(Alpha_Loop.this, Soundid[s]);
s++;
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer mp) {
mediaPlayer.start();
}
});
mediaPlayer.start();
updatetime = mediaPlayer.getDuration();
if (s >= Soundid.length) {
s = 0;
}
}
};
handler.postDelayed(Rn, updatetime);
}
}
我总是可以恢复为原始sql,但这将是轻松的出路;-)。
答案 0 :(得分:1)
benvc给出了正确答案:
select([table_a]).where(table_a.c.id.notin_(select([table_b.c.id])))