Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 73
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 400
Default MID function and SQL Query


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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Function query Rahul Excel Programming 2 August 25th 05 05:58 PM
query about VALUE function gvm Excel Worksheet Functions 1 August 9th 05 12:58 AM
Function: New Web Query vinrouge Links and Linking in Excel 2 July 2nd 05 04:54 PM
Microsoft Query rejects "nz" function in Access Query Vaughan Excel Discussion (Misc queries) 0 May 4th 05 05:20 PM
mid function in ms query suhair Excel Discussion (Misc queries) 1 February 24th 05 04:51 PM


All times are GMT +1. The time now is 04:52 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"