This may well be a very simple problem, but it's proving to be a stumbling point for me. I have two tables that I want to query. They contain the following columns:
user_id (primary key)
user_name (primary key)
post_id (primary key)
Both columns in the USER table have been given primary key status (is this allowed?) because user_id is an automated integer and I can join the 2 tables by using POST.user_name as a foreign key to the USER.user_name primary key.
I would like an SQL statement that can do the following:
1. When a person enters a string (in this case a full URL), it filters the recordset by only selecting data with the same URL. So something like this perhaps....
WHERE POST.post_url LIKE 'colname'
( colname = $_GET['SearchString'] )
2. Returns the remaining set of USER.user_name and USER.user_id values.
I hope I've included enough information so some of you can suggest some help.
they're individually the primary keys? no. you should have only 1 primary key in the table (or a combination of columns that form a primary key). You can make user_name unique, which is fine. You'll have better performance if you just use the id, but that's fine.
I'm not sure what your question has to do with joining tables, could you explain a little bit more.