Question: I have the following Javascript array, that contains JSON objects with 4 keys (team, pts, asts, rebs):

```
[
  {
     team: "A", 
     pts: "24",
     asts: "17",
     rebs: "14"
  },
  {
     team: "B", 
     pts: "24",
     asts: "11",
     rebs: "13"
  },     
  {
     team: "C", 
     pts: "14",
     asts: "27",
     rebs: "24"
  }
];

```

For some reason the **pts**, **asts**, and **rebs** data is all coming in as strings, whereas I need these to be numbers. Is there an easy way to specify an array of key names ["pts", "asts", "rebs"], and have the values for those key names convert from strings to numbers? 

Been struggling with this for longer than I'd like to admit, any help is appreciated!

Answer: 
you can't use max in where clause, try this:

```
SELECT song_id FROM played_songs WHERE id=(SELECT max(id) FROM played_songs)

```

but better solution is:

```
SELECT song_id FROM played_songs ORDER BY id DESC LIMIT 1;

```
You need to use a "Having" instead of a "where". A Having is used when you are operating on a previous calculation (getting max id is a calculation mysql has to make). I would write like this.

```
SELECT song_id, MAX(id) as 
max_id FROM ‘played_songs’ 
HAVING max_id=id

```