December 2nd, 2003, 07:06 PM
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
December 3rd, 2003, 11:14 AM
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
December 17th, 2003, 09:06 AM
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.
December 17th, 2003, 11:48 AM
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).