There are two tables
Students :
ID | Name | Age
---+------+-----
1 | Alex | 19
2 | Matt | 23
3 | Ali | 19
Actions :
ACTIONID | Description
---------+---------------------------
1 | Alex hasn't paid yet
I want to select Student ID with age 19. But don't want to select student whose name is contained in any row of description column from the Actions
table.
So result should be the following
ID: 3
How to do that? Could anybody help me?
Try this:
SELECT student.ID
FROM Students student
WHERE 0 = (SELECT COUNT(*)
FROM Actions action
WHERE action.Description LIKE CONCAT('%', student.Name, '%')
AND student.Age = 19;
如果我理解你的问题。
select ID from Students where Age = 19
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.