Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

How to check if two or more rows have the same field value?

I want to filter details from db. Database Example: id| First Name| Last Name1 | Saad | Usama2 | Saad | Usama3 | Saad | def I want to select the first row with the last name "usama" and then I want to skip the next row which has the same field "usama". any ideas ?

user-image
Question ajoutée par Usama Saad , Senior Software Engineer (Java) , Saudi Catering Company
Date de publication: 2013/08/22
Haitham Nabil Baioumi
par Haitham Nabil Baioumi , Country Manager , Bolt

------------------------------------------------------------------------------ select * from table_name where last_name = "usama" LIMIT1 ------------------------------------------------------------------------------ this will return the first occurance of last_name usama

Usama Saad
par Usama Saad , Senior Software Engineer (Java) , Saudi Catering Company

IF the table is like id| First_Name| Last_Name 1 | Saad | Usama 2 | Saad | Usama 3 | Saad | def -------------------------------------------------------------------- I found that it could be handled by the below select statment: select min(m.id) Idenfire , m.First_Name, m.Last_Name from new_table m group by m.First_Name, m.Last_Name ----------------------------------------------------------------- Result: 1 | Saad | Usama 3 | Saad | def

حنان يزه
par حنان يزه , متربص , شركة الاتصالات

select * from table_name where last_name="usama";

More Questions Like This