danIT Posted September 24, 2008 Posted September 24, 2008 I have a DB with two tables in it, one called Subjects and there called Subject Descriptions: Subjects: Column 1 = SubjectID Column 2 = Subject SubjectDescriptions: Column 1 = SubjectID Column 2 = Year (This just details which year the description relates to) Column 3 = SubjectDescription I want to 'Select * SubjectDescription from SubjectDescriptions' E.g. 1,Y7,Maths is about Numbers and stuff But I then want to change the SubjectID to the name of the subject, and icant for the life of me remember how? can anyone help?
SteveMC Posted September 24, 2008 Posted September 24, 2008 Something along the lines of: Select Subject,Year,SubjectDescription from Subjects,SubjectDescriptions where Subjects.SubjectID=SubjectDescriptions.SubjectID That should give you a result with the relevant fields. If you want the SubjectID as well, just include that in the list of fields to return. It's usually good practice not to use the 'select *' approach, as it can result in excessive memory usage if you don't intend to use all the fields. Stephen 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now