On 5 Jun 2011, at 5:47pm, Sam Carleton wrote:

> In one select statement, I want to return a view of all the Invoice_Items
> for a particular Invoice such that there is one column that contains all the
> image names in one string:
> 
> Invoice_Item_Id | Invoice_Id | Description | Image Names
> ----------------+------------+-------------+----------------------
> 1               |   1        | CD          | Img1, Img2, Img3

Take a look at the group_concat() function:

http://www.sqlite.org/lang_aggfunc.html

So just like you can use max(X), or total(X) in a SELECT, you can use 
group_concat(Image_Name) to string a bunch of returned values together, maybe 
something like

SELECT group_concat(Image_Name) FROM Image WHERE Invoice_Item_Id = 1

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to