+ Reply to Thread
Results 1 to 8 of 8

Thread: SQL Statement

  1. #1
    Guest.Visitor Guest

    Default SQL Statement

    SELECT substr(tmcode,3,1) as tmhold FROM mailfile WHERE substr(tmcode,3,1) = 'B' If you want to select all of the other fields too, then: SELECT m.*, substr(tmcode,3,1) as tmhold FROM mailfile as m WHERE substr(tmcode,3,1) = 'B' Chris

  2. #2

    Default SQL Statement

    Thanks Chris, that was the statement I was needing. Any suggestions on a good SQL book? Diane

  3. #3

    Default SQL Statement

    Books: SQL/400: A Professional Programmer's Guide Tim Martyn Richard Johnson Tim Hartley ISBN: 0070407991 Publisher: McGraw-Hill,1995 --------------------------- SQL/400 Developer's Guide ISBN: 1882419707 Paul Conte, Mike Cravitz Publisher: 29th Street Press/NEWS/400, 2000 IBM manuals http://publib.boulder.ibm.com/pubs/h...ymst02.htm#ToC http://www-919.ibm.com/servers/eserv...s/cpsqlref.pdf http://publib.boulder.ibm.com/iserie...s/qsqgnddl.htm Good luck

  4. #4
    Guest.Visitor Guest

    Default SQL Statement

    Not specifically for OS/400, but "SQL for Smarties" has some awesome examples.

  5. #5

    Default SQL Statement

    Thanks for the suggestions! I will check out all these books. Diane

  6. #6

    Default SQL Statement

    If I might be so bold there is also a book entitled iSeries and AS/400 SQL at Work which has extensive examples targeted to the AS/400 programmer. Information @ www.sqlthing.com Thanks Howard

  7. #7

    Default SQL Statement

    I'm not a strong SQL person---and this should be rather easy, but I can't seem to find the statement that will let me create a temporary hold field with interactive SQL. For instance, I have a mail code field that I want to extract out the third character into a "holdmail" field; holdmail being created on the fly, not defined in the physical file. I tried "SELECT tmhold(tmcode,3,1) FROM mailfile WHERE tmhold = 'B'" and this won't work for me. I am very familiar with query on the iSeries that allows me to create work fields on the fly--should I lose this technique or is there an SQL keyword that I am missing for this to work? Diane

  8. #8
    GlenKerner Guest

    Default SQL Statement

    Just a thought, why not use Query Manager to build a SQL with the defined fields and see how the iSeries will do it. The following is a simple SQL that I generated from Query Manager: SELECT -- Columns A.ODDCEN, A.ODDDAT, A.ODDTIM, substr(a.odobtx,1,10) AS TEXT -- Tables FROM "GLENLIB"/"DSPOBJD" A I suspect that is you are doing it in Query/400 you can do it in Query Manager and then create the SQL you need.

+ Reply to Thread

Similar Threads

  1. SQL Where Statement
    By Guest.Visitor in forum SQL
    Replies: 3
    Last Post: 06-02-2005, 09:58 AM
  2. HELP!!! HELP!!! SQL Statement
    By J.Pluta in forum SQL
    Replies: 4
    Last Post: 05-01-2002, 06:19 AM
  3. Insert statement
    By Guest.Visitor in forum Programming
    Replies: 3
    Last Post: 12-19-2000, 06:45 AM
  4. SQL0428 SQL statement cannot be run
    By Guest.Visitor in forum Programming
    Replies: 8
    Last Post: 10-23-2000, 12:38 PM
  5. Using the Eval statement in RPG IV
    By Guest.Visitor in forum Application Software
    Replies: 2
    Last Post: 08-09-2000, 01:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts