所以这是我今天无法解决的问题。
我想从数据库中获取一些详细信息。我不知道该怎么解释。但事情是这样的。
数据库示例:
标题|描述|标识符
1|说明|abc
2|说明|abc
3|描述|def
我想选择标识符为"abc"的第一行,然后我想跳过具有相同字段"abc"的下一行。
我正试图在PHP 中的SELECT mysql_query中使用它
要获得完整的行,可以执行
select * from your_table
where title in
(
select min(title)
from your_table
group by identifier
)
这个?
SELECT DISTINCT(identifier), title, description FROM tablename
在这种情况下,它还将返回带有"def"的行。
看起来整数字段被称为"title"。这应该获得最低的标题#,但根据您的要求删除重复的标题。
select min(title) as firstTitle, description, identifier
from table_name
where identifier in (select distinct identifier from table_name)
group by description, identifier.
select min(TITLE) as TITLE, DESCRIPTION , IDENTIFIER
From your_table
Group by DESCRIPTION , IDENTIFIER
select id, description, identifier
from table group by identifier order by id asc;