Question: I'm trying to grab the maximum ID number for a person, increment it by one, and store in a variable. I've been getting NULL until I initialized the variable to 0. Now i'm just getting 0. Could you help me out?

```
--Initialize @Var (probably unnecessary)
SET @Var = 0;

-- Increment Max Value by 1, store in @Var
Select @Var = (MAX(Person_ID) + 1) From Person;

--prints out the value 0????
Select @Var 

```

Answer: 
MySQL uses `:=` in `SELECT` to set values. So use this:

```
Select @Var := (MAX(Person_ID) + 1) From Person;

```

The use of `=` is just for a boolean expression. So the `SELECT` (with `=`) would return true/false (1/0), but not assign any values.
I wanted to add to @Gordon Linoff's answer that it would be better for performance if you retrieve the latest ID by ordering by person\_id and selecting the first record:

```
Select top 1 person_id from person order by person_id DESC

```