Question: What's the best way to make a select in this case, and output it without using nested queries in php? I would prefer to make it with a single query.

My tables look like this:

```
table1

id | items |
---|-------|
1  | item1 |
2  | item2 |
3  | item3 |
.. | ..    |

table2

id | itemid | comment  |
---|--------|----------|
1  | 1      | comment1 |
2  | 1      | comment2 |
3  | 2      | comment3 |
4  | 3      | comment4 |
5  | 3      | comment5 |
6  | 3      | comment6 |
.. | ..     | ..       |

```

This is the output i'm looking for.

```

item1
comment1
comment2

item2
comment3

item3
comment4
comment5
comment6

```

Thanks in advance

Answer: 
Checkout this JSON framework for Objective-C on [code.google.com](http://code.google.com/p/json-framework/) or on [Github](http://stig.github.com/json-framework/).

It is pretty straightforward to use. You instantiate your SBJSON object then call *objectWithString* with your buffer:

```
SBJSON * parser = [[SBJSON alloc] init];
NSString * buffer = @"{"name":"WFNX"}";
NSError* error = NULL;
// the type of json will depend on the JSON data in buffer, in this case, it will be 
// and NSDictionary with one key/value pair "name"->"WFNX"
id json = [parser objectWithString:buffer error:&error];

```
There are a few out there, see:

<http://code.google.com/p/json-framework/>  

<http://github.com/schwa/TouchJSON>

for a big list:

<http://www.json.org/>

is a great reference site for JSON