Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Create view in PSQL 9

Create view in PSQL 9

Create view in PSQL 9

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.

RE: Create view in PSQL 9

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.  

Certified Pervasive Developer
Certified Pervasive Technician

RE: Create view in PSQL 9

Super.  Thank you very much.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close