Solved

searching a database table where value of column is equal to value of a related table

Posted on 2009-03-29
1
189 Views
Last Modified: 2012-05-06
hi,
i want to write a query that selects values in a table dependent on the value in a related table. i have a table that stores information about files and the info stored is a filename and a series of codes relating to data in other tables.
so for example i want to search for files in the fle table that has a certain composer but the composer information for the file is not stored in this table, it is stored under a song name column which is an id and has the composer id related to it.
so for the file i just pick a song name and this song name has an id as a link to song name table and within this song name table is a composer ID that links to the composer table. i hope this makes sense?

i want to search for a composer and bring up all data from the files table with this composer?

i have included code i have been trying but it does not work
i am running this query in vb 2008
SELECT     File.AssetFileName, File.AssetSource, [Song Name].[Song Code]

FROM         ((File INNER JOIN

                      [Song Name] ON File.[Song Code] = [Song or Tune].[Song Code]) INNER JOIN

                      Composer ON [Song name].[Composer Code] = Composer.[Composer Code])

WHERE     (Composer.[Composer Code] = '1')

Open in new window

0
Comment
Question by:kipl20
1 Comment
 

Accepted Solution

by:
kipl20 earned 0 total points
ID: 24012988
no worries have worked it out
SELECT     File.AssetFileName, File.AssetSource, [Song Name].[Song Code]
FROM         ((File INNER JOIN
                      [Song Name] ON File.[Song Code] = [Song or Tune].[Song Code]) INNER JOIN
                      Composer ON [Song name].[Composer Code] = Composer.[Composer Code])
WHERE     (Composer.[Composer Code] = '1')

SELECT File.[AssetFilename],File.[AssetSource] 

FROM ((File INNER JOIN [Song Name] ON File.[SongCode] = [Song or Tune].[Song Code]) INNER JOIN Composer ON [Song Nsme].[Composer Code] = Composer.[Composer Code])

WHERE (Composer.[Composer Code] = " & vocalistcode & ")"

Open in new window

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Anyway to make "All" the default in the dropdown? 6 34
Syntax Error 2 44
C# Single Form 8 27
SQL Query Syntax Join 4 32
Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
'Between' is such a common word we rarely think about it but in SQL it has a very specific definition we should be aware of. While most database vendors will have their own unique phrases to describe it (see references at end) the concept in common …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now