Submitted Questions

  • Birthdate Query

    There is a table friends having following detailsName BirthdayJohn 28-jun-1985Peter 27-aug-1987Tom 13-aug-1986Nick 29-apr-1987Natalia 25-apr-1984Kate 28-jun-1984Wilson 11-nov-1987krish 31-jul-1987robert 25-apr-1984 SELECT names of the friends which come on the same day.. condition you don't know which birthday's repeat SELECT distinct...

    Jonno

    • Feb 1st, 2018

    Code
    1. --20180201 JL
    2. SELECT a.name, a.DOB FROM birthday a
    3.         INNER JOIN birthday b ON DAY(a.DOB) = DAY(b.DOB) AND MONTH(a.DOB) = MONTH(b.DOB)
    4. GROUP BY a.name, a.DOB
    5. HAVING COUNT(1) > 1
    6. ORDER BY a.DOB

    Prabakaran

    • Jul 27th, 2011

    Select name from btab where bday in (select distinct bday from btab)