Question: Hello I'm trying to write a program that prints 3 numbers from a range being restricted to numbers from 0 to 99,but my If statement isn't double checking the variable.

```
    System.out.println("Please input a interger between 0-99:");
    int input1 = Input.nextInt();

        if (input1>99||input1<0){ 
            System.out.println("Outside range. Please enter an integer between 0-99");
             input1 = Input.nextInt();
        }        

        else if (input1>99||input1<0); 
                           System.out.println("Outside range program terminated.");

```

Answer: 
```
select t1.* from order_history t1
inner join(
    select order_id,max(order_history_id) as order_history_id
    from order_history
    where ifnull(trackcode,'') <> ''
    group by order_id
) as t2 on t1.order_history_id = t2.order_history_id

```
```
SELECT * from order_history as oh inner join (
    SELECT MAX(order_history_id) AS max_id, order_id
    FROM order_history
    GROUP BY order_id
) as t ON t.max_id = oh.order_history_id
WHERE oh.trackc <>  ''

```

The sub-query extract the max value for every order\_id. Than joins the found values with order\_history and extracts every fields.