Hello - please help!
I have a SQL database with two tables.
Table1 contains user information (Fields: username, address1, address2, address3 etc)
Table2 contains posts from those users (Fields: username, category and post).
I'm trying to work out a sql statement which will return any/all posts from Table2 when a search is run against the 'category' field in Table 2, and it matches up with the fields: address1, address2, address3 in Table1. This is what I have so far..
FROM dbo.Table2, dbo.Table1
WHERE post = 'category' AND Address1 = 'area' OR Address2 = 'area' OR Address3 = 'area' OR Address4 = 'area'
So - you see, I only want posts returned when the category matches up with what is inputted for address1, 2 and 3.
What I have so far this doesn't work because it returns posts based on cateogry - but regardless of whether the address1,2 or 3 fields also match up.
I hope this makes sense, I've tried to explain as best I can. Any help would be muchly appreciated - I've been trying to figure this out for ages!