我有一个名为表:“纸”(question_bank)MySQL的选择查询显示在PHP
id | exam_id | question
1 | 1 | What will be 35*9?
2 | 1 | What will be 5-9?
3 | 1 | A + B
4 | 1 | What is a circle?
5 | 1 | If we have four corners with equal height and width, then which shape is that?
6 | 1 | What is Maths?
7 | 1 | What is a triangle?
21 | 1 | what is Nikhil surname?
22 | 2 | Last name of Bhavesh is
23 | 2 | Last name of Harsh is
27 | 3 | What is Maths?
28 | 3 | What is a triangle?
30 | 3 | Last name of Harsh is
我有一个PHP页面,我从表“纸”在exam_id“3”添加的问题。我的查询插入的问题是如下:
INSERT INTO paper (question exam_id) SELECT question, '3' FROM paper WHERE id = '2'
OR
INSERT INTO paper (question exam_id) SELECT question, '3' FROM paper WHERE id = '1'
OR
我还可以添加一个新的问题,因此该查询:
INSERT INTO paper (question, exam_id) VALUES ('blah blah blah', '3')
这取决于问题我选择或任何新的问题,我补充。
现在,当我想从table'paper'向exam_id'3'添加更多问题时,它会显示所有问题。我的选择查询如下:
SELECT * FROM paper WHERE exam_id != '3'
它显示了所有的问题,但比如我已经添加ID =“23”,所以我不想这个问题,当我加入了更多的问题来显示。请帮我选择查询。让我知道如果我错过任何东西!提前致谢!
我不明白。你正在用'exam_id!= 3'查询所有的问题,但是你不想用'id = 23'这个问题?没有任何意义,因为后者符合条款 – paubo147
中的条件,因为我已经在exam_id = 3中添加了id = 23,我不想在向exam_id = 3 –