0

How to fetch plate_number which apeear multiple times in column

database:numbers

table name:number_plate

plate_number
45990
54667
45990
0908
54667
65534
3422
0908

output:
45990
45990
54667
54667
0908
0908
Mihai
  • 26,325
  • 7
  • 66
  • 81
Hasif
  • 39
  • 1
  • 6
  • http://stackoverflow.com/questions/10324107/show-all-duplicated-rows This will help you out. – Shrey Mar 15 '17 at 07:02

1 Answers1

1

This one would give you recurring plates and number of occurrences

select  plate_number, count(*) 
from    table
group by plate_number
having count(*) > 1

To have the exact output you wrote, you should join the query above with the table again

select  t1.plate_number
from    table t1
join    (
            select  plate_number
            from    table
            group by plate_number
            having count(*) > 1
        ) t2
on     t1.plate_number = t2.plate_number
order by t1.plate_number
Stefano Zanini
  • 5,876
  • 2
  • 13
  • 33
  • select plate_number from table group by plate_number having count(*) > 1 – krishn Patel Mar 15 '17 at 07:19
  • you can write like this also – krishn Patel Mar 15 '17 at 07:19
  • Can u please help:How to colour(red) 6,7,8 number from database $number=$row['plate_number']; ex: 89786 74867 1687 86767 56786 78611 78686 i wanted to colour 786 countinues or 6,7,8 only single digit should red not multiple digits in the case 78686 it should red first 786 remaining 86normal colour – Hasif Mar 15 '17 at 07:57
  • You should really ask a new question, so that you can explain it better – Stefano Zanini Mar 15 '17 at 08:12