I'm currently running two SQL queries, one is very simple, all it does is return the titles of the products. I've made an application which will look through all products and only gather a select few depending on what the user has searched for. So the SQL is like so:
SELECT Title FROM Table1
However, in order for the products to have a link assigned to them, so the uesr an look at each product individually, I need another query, which looks at another two different tables, so the query I'm running there is like so:
SELECT Table1.PID,
Table1.Title,
Table2.PID,
Table2.FID,
Table3.FID,
Table3.URL
FROM Table1, Table2, Table3
WHERE Table1.PID = Table2.PID
AND Table2.FID = Table3.FID
Now if I were doing this correctly, then both queries would return the same number of results. However, sadly, I'm clearly doing something wrong as there are roughly 200 products returned that do not have a URL assigned to them.
I'm assuming there's something wrong with the logic I'm using here, and if anyone tells me to change the structure of the DB, I have not got access to change the DB, only access to query the DB.
FYI. I know that the URL and the Title aren't being used in the query, but that's the data I'm trying to output.
Any help would be much obliged. I wouldn't be posting it here if I wasn't stuck, I've tried a lot of different things, and sadly there has been no luck as of yet. I've been stuck on this issue for a few days now, so yeah, it's probably that I'm a total noob with SQL, or so I'm assuming.
I've also tried to include the LIKE operator in there, but at the moment, it's too specific, and isn't returning enough data for my liking OR for the needs of the website.
In the second query, I just tried to include:
AND Table1.Title LIKE '%search%'