#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    1
    Rep Power
    0

    Unhappy Beginner: 2 query's from 1 table


    I have an acces database.
    One table contains personal data like name, adress, tel, fax ...

    I need to make 2 query's.
    One that contains the people that live at the same adress (not the same name) and one with the people that live alone.

    How do i do this? i really have no idea . Pls help me.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    Paris Uppland
    Posts
    2,377
    Rep Power
    391
    Code:
    // for multiple 
    
    select * from t
    where adress in 
    (select adress from t
      group by adress
      having count(*) > 1)
    
    //for solitairies
    
    select * from t
    where adress in 
    (select adress from t
      group by adress
      having count(*) = 1)

IMN logo majestic logo threadwatch logo seochat tools logo