Question: I have a query like this:

```
SELECT `*` 
  FROM (`threads` t, `members` m) 
 WHERE `m`.`id` = t.author 
   AND `t`.`type` = '0' 
   AND `t`.`category` = '1'

```

And basically what happens is that there is an ID field in both tables (members and threads) so what's happening is that the results array is getting messed up. IE: There is only one ID field which is being populated from the members table.

What I need to do is make the results with a prefix infront of their key name so I can distinguish between the two:
IE: Add 't.' to all thread fields and 'm.' to all members fields.

So results should be like: m.id = x, t.id = y
Instead, results at the moment are like: id = x (the id field from the thread table is completely overwritten by the one from the members table)

Answer: 
You could do it by naming each column one by one:

```
SELECT m.`id` AS "m_id", `t`.`id` AS "t_id", t.`username` AS "t_username"
FROM (`threads` t, `members` m) 
WHERE `m`.`id` = t.author 
   AND `t`.`type` = '0' 
   AND `t`.`category` = '1'

```
You can set an alias for columns that have the same name:

```
SELECT t.ID as threadsID, m.ID as membersID, <...> WHERE `m`.`id` = t.author AND `t`.`type` = '0' AND `t`.`category` = '1'

```