Posted on 2009-04-23
Last Modified: 2013-12-25
I have a key wich could look like:
"07PLVEL       SL4             54.1300   "
if I use SELECT * FROM "OMZETTEN" WHERE LEFT(KEY_2,7)='07PLVEL'  works fine
but how to call if I want only keys  like:
SELECT * FROM "OMZETTEN" WHERE LEFT(KEY_2,7)='07PLVEL'  and  mid(key_2,15,3)   = 'SL4'   this will give error
SELECT * FROM "OMZETTEN" WHERE mid(KEY_2,3,5)='07PLVEL'  and  mid(key_2,15,3)   = 'SL4'   this will give error
Question by:BIAPRO
    1 Comment
    LVL 18

    Accepted Solution

    What error?  
    There is no MID function in PSQL 2000i. You need to use the SUBSTRING function:
    SUBSTRING (string1, start, length) - Returns a character string derived from
    string1 beginning at the character position specified by start for length characters.

    So, your query should be:
    SELECT * FROM "OMZETTEN" WHERE LEFT(KEY_2,7)='07PLVEL'  and  SUBSTRING(key_2,15,3)   = 'SL4'  
    SELECT * FROM "OMZETTEN" WHERE SUBSTRING(KEY_2,3,5)='07PLVEL'  and  SUBSTRING(key_2,15,3)   = 'SL4'

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Introduction After workin in a plethora of programming languages like C, Pro*C, ESQL/C, C++, VC++, VB, Java, HTML,JavaScipt etc, technologies and frameworks like JSP, Servlets, Struts, Spring, IBatis etc and databases like MS Access, SQLServer, Inf…
    I guess that all of us know that caching the data usually increase the performance, but I worried if all of us are aware about the risk that caching the data provides and how to minimize this.  That’s the reason why I decided to write this short art…
    Video by: Steve
    Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now