Click here to Skip to main content
16,011,805 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HI ALL

I WANT TO USE A SUBSTRING FOR A SELECT QUERY

SQL
select  COLUMN1,COLUMN2,COLUMN3,
           COLUMN4,COLUMN5,COLUMN6,(select cust_location from d_man_regn where cust_folio_no = 'VALUES' and com_ref_no = 'VALUES' AND man_regn_status in('VALUES','VALUES')),COLUMN8
           from TABLE_NAME

THE ABOVE QUERY IS USED BY ME WHILE EXECUTING THIS QUERY I AM GETTING 8 COLUMN VALUES. I want to use a substring for the column8 value.

Can anyone provide a solution for me.

Rgds
Jagadesh
Posted

1 solution

The substring query works almost the same like it is used in string functions of several programming languages.

SQL
SUBSTRING ( expression ,start , length )


So in your case, if you want to get just a substring of the value in COLUMN8 (if I got you right here) than edit your query to:

SQL
select  COLUMN1,COLUMN2,COLUMN3,
           COLUMN4,COLUMN5,COLUMN6,(select cust_location from d_man_regn where cust_folio_no = 'VALUES' and com_ref_no = 'VALUES' AND man_regn_status in('VALUES','VALUES')),Substring(COLUMN8, start, length)
           from TABLE_NAME
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900