Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一张 MySQL 照片表,并将它们的尺寸存储在一个 varchar 字段中,即。“1024x768”。有没有办法选择高于或等于给定尺寸的照片,而无需修改表格以分别存储“高度”和“宽度”?
谢谢
SELECT * FROM photos WHERE CAST(SUBSTR(dimensions, 1, LOCATE("x", dimensions)-1) as NUMBER) > @height AND CAST(SUBSTR(dimensions, LOCATE("x", dimensions)+1)) as NUMBER) > @width