+ Reply to Thread
Results 1 to 3 of 3

MID function and SQL Query

  1. #1
    Soniya
    Guest

    MID function and SQL Query

    Hello!

    Is it possible to use MID fiunction in SQL Query?

    Or is there any other way to get it done..
    StrSQL = " SELECT " & _
    " j.Accno, SUM(j.db)DR, SUM(j.cr)CR, Month(j.Trdate)Month,
    LEFT(j.tktno,4)ARL"
    I would like to get "MID(j.Accno, 5, 3)Loc"

    three charecters from Accno starting fifth character.

    Thanks


  2. #2
    AA2e72E
    Guest

    RE: MID function and SQL Query

    Use SUBSTRING instead of MID (same syntax)

    PS:
    instead of

    SUM(j.db)DR

    write

    SUM(j.db) AS DR

    makes t he SQL more readable and closer to the SQL conventions.


    "Soniya" wrote:

    > Hello!
    >
    > Is it possible to use MID fiunction in SQL Query?
    >
    > Or is there any other way to get it done..
    > StrSQL = " SELECT " & _
    > " j.Accno, SUM(j.db)DR, SUM(j.cr)CR, Month(j.Trdate)Month,
    > LEFT(j.tktno,4)ARL"
    > I would like to get "MID(j.Accno, 5, 3)Loc"
    >
    > three charecters from Accno starting fifth character.
    >
    > Thanks
    >
    >


  3. #3
    AA2e72E
    Guest

    RE: MID function and SQL Query


    I assumed you are using SQL Server. For Oracle, use SUBSTR. The Excel/Access
    drivers can use MID.




+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1