i´m new in SQL and want to solve following case.
I have a table in a MariaDB named inventories. In this table are 2 columns: identifier and data. I want to select and output a specific part in the column data, if the identifier is a specific one.
For example:
identifier | data |
---|---|
steam:xxxxxxxxxxxxxxx | ...some data...,"Serial":"ZF3CJ8L1rrKjwP7nKTzb",...some more data... |
The only part, that i want in the output is this: "Serial":"ZF3CJ8L1rrKjwP7nKTzb" but the part behind "Serial":" is a random value.
How can i solve this?
(i put a screenshot in here, table does not work for me in editorscreenshot of table in stackoverflow editor.)
CodePudding user response:
You can try using the SubString function, which only returns a certain amount of character and starts a whatever character you want.
CodePudding user response:
I got it!
SELECT (SUBSTRING(data, LOCATE('"Serial":"', DATA) 0, 31)) FROM inventories where identifier = 'steam:xxxxxxxxxxxx';