Request:

(SELECT `Feed`.*,`Users`.UID,`Users`.Name FROM `Feed`,`Users` WHERE `Feed`.ID > '22' AND ((`AccessKey` = '' or `AccessKey` = 'key123') AND (`Feed`.UserCreate = `Users`.UID))) LIMIT 0,10 

There are 2 users, ID 1 and 2. With this query, the result is all 10 records of only one user, that is, with ID = 1. And I need to simply add to the table 2 columns with the name and user ID of the person who added this record.

How can you not know about JOINs and UNION, but! which is inappropriate.

And yes, I can't swap the Feed and Users tables, because there are a lot of conditions for Feed, and Users like that, only 1 sample by ID

alt text

    2 answers 2

    1. not. Your query selects 10 entries, among which can be either entries from a user with id = 1, or from 2, or 1000. hint: limit without an order by order has no use.
    2. you already have join, only it is called the "old" join, when the connection is indicated in the where expression. union is out of place here. fields, as a result of the selection, do not depend on join'a or union'a, this is also not the case.
    3. from the rearrangement of factors, the product does not change.

    Give an example of your data and what you want to get as a result. to table 2 you have already added your two columns.

    • As you can see, passes ID = 24,25,26 ... At which UserCreate = 2 and not 1 - Man

    Understood, the problem was obvious, I forgot to add ORDER BY