So here's the problem I can't work around today.
I want to grab some details from a database. I'm not sure how to explain this. But here goes.
Database Example:
1 | Description | abc
2 | Description | abc
3 | Description | def
I want to select the first row with the identifier "abc" and then I want to skip the next row which has the same field "abc".
I'm trying to use this in a SELECT mysql_query in PHP
To get the complete row you can do
select * from your_table
where title in
(
select min(title)
from your_table
group by identifier
)
This?
SELECT DISTINCT(identifier), title, description FROM tablename
It will also return the row with 'def' in this case.
It appears that the integer field is called 'title'. This should grab the lowest title # but remove the duplicates as you requested.
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;
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.