• Notice regarding image hosts and attachments. See here.

SQL Statement help

Capodecina
Permabanned
Joined
31 Dec 2003
Posts
5,173
Location
Barrow-In-Furness
Can't figure out this SQL statement, two tables..

tblCodes
CodeID
CodeCategory

tblHours
TimeCode
blah
blah
blah
blah

Trying to SELECT all fields from tblHours where the CodeCategory = @SelectedCodeCategory

Been messing for a little but I just can't get anything working. Can anyone help?
 
SELECT * from tblHours
JOIN tblCodes
ON tblHours.TimeCode = tblCodes.CodeID
WHERE tblCodes.CodeCategory = @SelectedCodeCategory

This is on the assumption that the TimeCode column on the Hours table relates to the CodeID column on the Codes table.

Cheers, yes TimeCode does relate to CodeID :)

How do I limit the fields from tblCodes, I only need CodeCategory really...
 
Back
Top Bottom