You can use SUBSTRING_INDEX
. Like this:
select linkurl as DOWNLOADURL,lastrevlevel as VERSION, code as DESCRIPTION,created as RELEASEDATE, SUBSTRING_INDEX(name,'.',-1) as TYPE from datas where id in (select child_id from datas _datas where parent_id=( select max(id) from datas where code = 'AN4307SW'))
EDIT
If you see documents on this feature, I think it will meet your requirements.
Returns the substring from the string str before counting the occurrences of the delimiter. If the number is positive, everything is returned to the left of the trailing separator (counting to the left). If the counter is negative, everything is returned to the right of the ending delimiter (counting to the right). SUBSTRING_INDEX () performs case-sensitive searches when searching for a delimiter.
This will also handle a case like this:
select SUBSTRING_INDEX('Test.Document.doc','.',-1);
EDIT2
If you are using an oracle. Please mark the question in the correct question next time. There SUBSTRING_INDEX
no SUBSTRING_INDEX
. But what I see, you can do it quite easily:
SELECT SUBSTR('Test.Document.doc', INSTR('Test.Document.doc', '.',-1)) FROM dual;
Full query like this:
select linkurl as DOWNLOADURL,lastrevlevel as VERSION, code as DESCRIPTION,created as RELEASEDATE, SUBSTR(name, INSTR(name, '.',-1)) as TYPE from datas where id in (select child_id from datas _datas where parent_id=( select max(id) from datas where code = 'AN4307SW'))
Link here