as topic says, I don't want to return the first two letters in the return values just an example: select companyname from companies returns companyX
Can I write a query that returns panyX instead?
Thanks in advance
To delete the first characters from the field we will use the following query: Syntax: SELECT SUBSTRING(string, 2, length(string));
Let us see the following example which I have written with the help of a sample database AdventureWorks. In the following table, we can skip the top 100 rows by just using the keyword OFFSET and not specifying the FETCH keyword.
Any text between /* and */ will be ignored.
select right(companyname, len(companyname)-3) as companyname
will do the thing (this should work for microsoft T-SQ, see more string functions here )
Since you don't say what RDBMS you're using, here is an ANSI-compliant answer:
SELECT SUBSTRING(mycolumn,3,CHARACTER_LENGTH(mycolumn))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With