Link to home
Start Free TrialLog in
Avatar of tonelm54
tonelm54

asked on

Select multiple blobs in one coloum one record

Good evening,
Ive been dealing with blobs over the past few days, and experienced several issues with my application dealing with them. I have solved it by splitting a blob file up over multiple records, so instead of having one massive blob in a record, I now have a table:-
CREATE TABLE `fileBlob` (
`fileID` BIGINT NOT NULL ,
`part` INT NOT NULL ,
`blob` TINYBLOB NOT NULL 
)

Open in new window


Which works great for uploading files into the table, but messy when downloading. Currently I call the statment and work through each row appending the blob output:-
SELECT * 
FROM `fileBlob` 
WHERE `fileID` =27
ORDER BY `part` ASC 

Open in new window


Is it possible to group all the blob data together ordered by `part` from a `fileID`, so something like:-
SELECT GROUP_CONCAT(`blob`) as blobData 
FROM fileblob
WHERE `fileID` =27

Open in new window

However the GROUP_CONCAT would obviously have to be ordered, and I dont know how to tell it to only dislay the blob data.

Any help would be appriciated.

Thank you
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tonelm54
tonelm54

ASKER

There isnt really much of an issue, just haveing to put code in to perform the loop and append the data, would have been nice just to do it all in the SQL statment.

If group_concat has a size limit, I dont see any other way of doing apart from looping and appending!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial