ابدأ بالتواصل مع الأشخاص وتبادل معارفك المهنية

أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.

متابعة

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
تم إضافة السؤال من قبل Usama Saad , Senior Software Engineer (Java) , Saudi Catering Company
تاريخ النشر: 2013/08/22
Haitham Nabil Baioumi
من قبل 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
من قبل 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

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

select * from table_name where last_name="usama";

المزيد من الأسئلة المماثلة