我想知道如何查询这个结构: 我怎么能
SELECT only 1 ID FROM portfolio
WHERE category = "x" AND DISTINCT description = 'x'?
(表名和字段)
portfolio:
ID, client, section, category, description, year, files
编辑:谢谢你的回答。
答案 0 :(得分:1)
SELECT MAX(ID)
FROM profolio
WHERE category = 'x' AND description = 'x'
答案 1 :(得分:0)
您可以在mysql中使用limit语句,如下所示。
select id from portfolio where category='x' and description='x' limit 1 offset 0
答案 2 :(得分:0)
SELECT ID from portfolio WHERE category = 'x' AND description = 'x' LIMIT 1;