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

    Join Date
    Dec 2003
    Posts
    2
    Rep Power
    0

    searching and displaying records from a database using coldfusion


    I have a database and a couple of tables in it. I need the code to search on a particular field and then display these results on the web page.

    I am uploading the database and hope to hear soon on the following example...

    I wasnt to search on the "AName" field in the ARTIST" table and then display a couple of fields from this table and also "Title" and "Release Year" fields from the table "MUSICVIDEO".

    The ANAME fieldand the Title Field are connected in another table "ARTISTVIDEOINVOLVEMENT". with their respective ID's

    Thanks
    Arvind
  2. #2
  3. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,273
    Rep Power
    968
    So are you asking for SQL code? Sounds like a relatively simple query...depending on the relationship between the tables, something like:

    select artist.aName, mv.title, mv.releaseYear
    from artist, musicVideo mv, artistVideoInvolvement avi
    where artist.artistID = avi.artistID
    and avi.musicVideoID = mv.musicVideoID
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Buffalo, NY
    Posts
    156
    Rep Power
    12
    Did that answer his question?

    Would this need a join? He said that the tabels were linked on the ID field.

    I've never selected from multiple tables like that kiteless. I'm going to have to check that out.
    Forget Milk!
    Gotspy?

    www.gotspy.com
  6. #4
  7. No Profile Picture
    Moderator

    Join Date
    Jun 2002
    Location
    Raleigh, NC
    Posts
    5,273
    Rep Power
    968
    What I wrote is an inner join that links the tables on the ID fields (I assumed the names of his ID fields in the join, but he could use whatever fields actually represent the primary/foreign keys).

IMN logo majestic logo threadwatch logo seochat tools logo