Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sql with substring to a special character with sqlite

Tags:

sql

sqlite

I have values with following format in a table in sqlite:

AAAAAAAAAA#BBBBBBBBBB

AAAA#BBBBBBBBBB

AAAAAAAAAAAAAAAAA#BBBBBBBBBBB

I would like to create a SQL where I get the following result:

AAAAAAAAAA

AAAA

AAAAAAAAAAAAAAAAA

In other words. I would like to get the substring from 0->character #. How can I do this ?

like image 925
mcfly soft Avatar asked Sep 17 '26 06:09

mcfly soft


1 Answers

Please try:

SUBSTR(col,1,INSTR(col,'#') -1)

Can be found at: http://www.sqlite.org/lang_corefunc.html

like image 145
MarcelFrehe Avatar answered Sep 19 '26 02:09

MarcelFrehe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!