Results 1 to 4 of 4

Thread: database matching

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    132
    i am creating a CD Database for a school assessment (last year high school) and i got one table which is my main table, and each cd has it's own table (all same format) but want to display info from the main table and the others tables at the same time. How?

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238

    Lightbulb Use Left Join Statement.

    Properly you can use LEFT JOIN statement. But can you just post your database structure, so that I can have a better understand on your database structure before I work out some sample code for you?

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Jun 2000
    Posts
    132
    ok my database structue is like so

    Main Table contains

    Band Name - field 1
    Album Name - field 2
    Album/Single - field 3
    Released - field 4
    Company - field 5
    Serial - field 6

    and the individual cd tables are named by album name so i can use that to link but the sturcture is as follows

    Track No - field 1
    Track title - field 2
    Track time - field 3


    So far the front end displays 1 record from the main table and i want to display the relative table. oh and how do you write SQL in VB?

  4. #4
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Before you can use the LEFT JOIN syntax, you need to add one more reference into your individual CD table (Here I named it as TrackTable) and the code just like below:

    Code:
    "SELECT * FROM MainTable LEFT JOIN TrackTable ON MainTable.AlbumName = TrackTable.AlbumName WHERE MainTable.AlbumName='" & <Your Choice> & "';"
    Without the relationship between the MainTable and the TrackTable (AlbumName Field) I don't think you can retrieve the individual CD information.



    [Edited by Chris on 06-10-2000 at 02:11 PM]

Posting Permissions

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



Click Here to Expand Forum to Full Width