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
MySQL ServerSQL

Avatar of undefined
Last Comment
Kevin Cross

8/22/2022 - Mon