0

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:

TITLE | DESCRIPTION | IDENTIFIER

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

4

5 に答える 5

1

あなたができる完全な行を取得するには

select * from your_table
where title in 
(
  select min(title)
  from your_table
  group by identifier
)
于 2013-08-22T16:16:29.683 に答える
0
select id, description, identifier 
from table group by identifier order by id asc;
于 2013-08-22T16:35:11.540 に答える
0

整数フィールドは「タイトル」と呼ばれているようです。これにより、最も低いタイトルが取得されます # が、要求どおりに重複が削除されます。

select min(title) as firstTitle, description, identifier
  from table_name
  where identifier in (select distinct identifier from table_name)
  group by description, identifier.
于 2013-08-22T16:22:51.830 に答える
0
select min(TITLE) as TITLE, DESCRIPTION , IDENTIFIER 
From your_table
Group by DESCRIPTION , IDENTIFIER 
于 2013-08-22T16:23:00.947 に答える