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

Thread: while loops

  1. #1
    Regular Coder seco's Avatar
    Join Date
    Nov 2008
    Location
    Oregon
    Posts
    687
    Thanks
    6
    Thanked 79 Times in 77 Posts

    while loops

    Ok so im pretty sure im not doing this right but im not entirely sure how i would go about doing it. so here is the problem.

    Ive got 3 tables, aquired, songs, bracelets.

    aquired consists of

    id, uid, bid

    and there will be multiple with the same uid but different bid.

    Code:
    SELECT * FROM aquired WHERE uid='123'
    now aquired has a field for bid and the bid we will say is 3, this comes into play next.

    Code:
    SELECT * FROM song, bracelets WHERE song.bid='3' AND bracelets.bid='3'
    so i need to create a loop that shows the data from song and bracelets based on the aquired bid field, can anyone help me here?

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,863
    Thanks
    160
    Thanked 2,224 Times in 2,211 Posts
    Something like
    Code:
    Select  S.column_A,S.column_B, B.column_A,B.column_B from song as S
    inner join (bracelets as B, aquired as A)
    on (A.uid=123 and S.bid=A.bid and B.bid=A.bid)
    ?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)


  •  

    Posting Permissions

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