Results 1 to 2 of 2

Thread: hard query

  1. #1
    Join Date
    Jan 2011
    Posts
    1

    hard query

    Hello everybody, I have a question:


    My database is like so:

    House(id_house,description)

    Property(id_property,id_house,id_person)

    Person(id_person,name,description)

    Car(id_car,id_person,name)


    One person can be the Owner of one or more Houses, and one House can have one or more Owners (People).

    One Person can have one or more Cars.


    I want do a query which give:

    the name of the Cars of the People who are the Owner of the House with the id_house='1'.


    Any idea?


    Thanks.

  2. #2
    Join Date
    Feb 2011
    Posts
    3

    Smile Re : hard query

    Hi lupo ,

    try this

    SELECT id_car FROM car WHERE id_person IN
    (SELECT id_person FROM property WHERE id_house='1' )


    let me know if this works

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •