How does MySQL image name array match the image path field of the table

CSDN Q & A 2022-02-13 05:11:24 阅读数:827

mysql image array match image

Scenario as follows :
Known array str=["a.png","b.png","c.png",d.png]
The table fields are as follows
id urlPath
1 "img/a.png"
2 "img/b.png"
3 "img/abc.png"
1、 The result is , I want to compete c.png、 and d.png These two documents are not in the table . One sql sentence Table name :imgTable
I hope some great God can help me see .sql How to write .




Take the answer :

SELECT * FROM imgTable where right(urlPath, 4) not in (str)



Other answers 2:

SELECT * FROM imgTable where SUBSTRING(urlPath, 5,LENGTH(urlPath)) not in (str)

copyright:author[CSDN Q & A],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130511227566.html