Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Posts
    713
    Thanks
    6
    Thanked 2 Times in 2 Posts

    How to make this search?

    Hi, my table is like this

    [blktable]
    blkid
    blkname

    [flattable]
    flatid
    flatnumber
    blkid

    [occupant]
    oid
    occupant
    flatid

    how can i get occupant, flatnumber, blkname is a single sql search, how to do?
    flying dagger

  • #2
    Registered User
    Join Date
    Oct 2004
    Posts
    592
    Thanks
    0
    Thanked 1 Time in 1 Post
    Easy stuff!
    I rename table names for clarity.

    Code:
    SELECT occupant, flatnumber, blkname
    FROM table_blk, table_flat, table_occupant
    WHERE 
                    table_occupant.flatid = table_flat.flatid AND
                    table_flat.blkid = table_blk.blkid
    Some Database Concept

    1. Draw ERD.
    2. Identify Relationships between entities like 1-1 or 1-*.
    3. Write SQL Where statement by tracing top-down or bottom-up approach.


  •  

    Posting Permissions

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