Question: I am trying to write mysql statement that selects the last added value from the table.
Since the id column in my table is an auto increment value, I find that the easiest way to do this is selecting the row with the highest ID value.

I was wondering if anyone can help me accomplish this?

Something like this:

mysql\_query("SELECT \* FROM table WHERE id=max(id)"

Answer: 
MAX is an aggregate/group function you can't use like this 

try this 

```
SELECT * 
FROM blog 
ORDER BY id DESC LIMIT 1;

```

OR

```
SELECT * 
FROM blog 
where id=LAST_INSERT_ID();

```

OR 

```
SELECT *
FROM blog 
WHERE (id = (SELECT MAX(id) FROM blog LIMIT 1))

```
You can use `LAST_INSERT_ID()` to find last inserted id.Hence, your query can be like this:

```
SELECT * 
FROM blog 
where id=LAST_INSERT_ID();

```

To work with your query, you have to do like this:

```
SELECT *
FROM blog
WHERE id=(
    SELECT max(id) FROM blog
    )

```