Question: Local server this query run smooth. But when I run this hosting server i get this error

> 
> #1054 - Unknown column 'orders.id' in 'order clause'
> 
> 
> 

EDIT
----

> 
> This is not my server problem. this is phpmyadmin unexpected problem.
>  I discover this when I run this same query on mysql workbench. mysql
>  workbench return exact result
> 
> 
> 

Here is my query. *Note that I have `orders.id` column*

```
SELECT * FROM orders ord1
join (select * from orders where orders.is_visible=1) ord2
on ord1.id=ord2.id
where ord1.company_id is not null 

```

Answer: 
Are you using phpMyAdmin by any chance? My understanding is that phpMyAdmin adds an `order by` clause. If you explicitly select the columns you actually need (rather then `*`) it should fix the problem.
The same result you are trying to achieve can be obtained by doing the following:

```
SELECT
    *
FROM 
    orders 
WHERE
    company_id IS NOT NULL
    AND is_visible = 1

```

Try to run this query which basically does the exact same, however more efficiently. You do not need to join a table to itself in order to apply multiple conditions.