Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create view in PSQL 9

Status
Not open for further replies.

genekr

Technical User
Jul 19, 2005
45
0
0
US
Good morning. I'm very new to PSQL and need to create a view. Is it possible to take a value, have that value in a view and take the first 5 char's and put that in another field and the second 5 chars and put that in another field. My result should be like:


Item Main Sub
123456789123456 12345 67891

I want to be able to link this view to an "Item" table in a CR9 report and select the Main or Sub values, so the user will only have to select the Main or Sub values for a parameter.

Any help is appreciated.
Gene
 
The following shows the correct values:
create table viewtest ( f1 char(16))
insert into viewtest values ('123456789123456')
select f1, left(f1,5), substring(f1,6,5) from viewtest

So to answer the question, you need to use the LEFT and SUBSTRING to get the values you want. You don't need a view specifically.


Mirtheil
Certified Pervasive Developer
Certified Pervasive Technician
 
Super. Thank you very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top