I have a invoice system where one invoice item can have one or more sum
items (images). Example is a CD... The invoice item is a CD, there are an
infinite numbers of images associated with that CD invoice item. So I have
the following:
CREATE TABLE Invoice_Item (
Invoice_Item_Id INTEGER PRIMARY KEY AUTOINCREMENT,
Invoice_Id INTEGER NOT NULL,
Description VARCHAR(80) NOT NULL
)
CREATE TABLE Image (
ImageId INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
Invoice_Item_Id INTEGER ,
Image_Name VARCHAR(260) NOT NULL,
)
The Invoice_Item table has one row in it where the PKID is 1 and description
is "CD", the Image table has three rows in it, all with a Invoice_Item_Id of
1 and different image names: Img1, Img2, and Img3.
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
Can I do this with SQL? If not, can I do this with a user defined
function? The UI is going to allow the user to select the row and edit it
in another screen.
Sam
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users