It better to LEFT join rather then NOT IN
On Wed, Sep 30, 2015 at 6:00 PM, Mogens Melander
wrote:
> Maybe not the most optimal, but (probably) the most simple:
>
> SELECT * FROM fruit
> where id not in (select fruit from purchase
> where customer=1);
>
> 1, 'Apples'
>
Maybe not the most optimal, but (probably) the most simple:
SELECT * FROM fruit
where id not in (select fruit from purchase
where customer=1);
1, 'Apples'
3, 'Oranges'
On 2015-09-30 00:01, Richard Reina wrote:
If I have three simple tables:
mysql> select * from customer;
+++
| ID
If I have three simple tables:
mysql> select * from customer;
+++
| ID | NAME |
+++
| 1 | Joey |
| 2 | Mike |
| 3 | Kellie |
+++
3 rows in set (0.00 sec)
mysql> select * from fruit;
++-+
| ID | NAME|
++-+
| 1 | Apples |
|
On 9/29/2015 1:27 PM, Ron Piggott wrote:
On 29/09/15 13:01, Richard Reina wrote:
If I have three simple tables:
mysql> select * from customer;
+++
| ID | NAME |
+++
| 1 | Joey |
| 2 | Mike |
| 3 | Kellie |
+++
3 rows in set (0.00 sec)
mysql>
On 29/09/15 13:01, Richard Reina wrote:
If I have three simple tables:
mysql> select * from customer;
+++
| ID | NAME |
+++
| 1 | Joey |
| 2 | Mike |
| 3 | Kellie |
+++
3 rows in set (0.00 sec)
mysql> select * from fruit;
++-+
| ID |