Help for sql select statement

Help for sql select statement

Postby Horizon » Mon Mar 30, 2020 2:42 pm

Hi,

I have this code:
Code: Select all  Expand view

        xTARIH = CTOD("30/03/2020")
        USE AJANDA ORDER "BAGNO" ALIAS "AJANDA_Array_Guncelle" READONLY
        SET SCOPE TO "HY00000000", "HY99999999"
        SSART :=  'xTARIH >= AJ_BTAR .AND. xTARIH <= AJ_TARIH'
        SET FILTER TO &SSART


I use MariaDB. How can I convert this to sql select for using oCn:RowSet method?

Thanks.
Regards,

Hakan ONEMLI

Harbour & MSVC 2022 & FWH 23.04
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm

Re: Help for sql select statement

Postby nageswaragunupudi » Mon Mar 30, 2020 4:11 pm

Code: Select all  Expand view

SELECT * FROM ajanda WHERE BAGNO BETWEEN 'HY00000000' AND 'HY99999999' AND AJ_BTAR >= '2020-03-30' AND AJ_TARIH <= '2020-03-30'
 


OR

Code: Select all  Expand view
SELECT * FROM ajanda WHERE BAGNO LIKE 'HY%' AND AJ_BTAR >= '2020-03-30' AND AJ_TARIH <= '2020-03-30'
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Help for sql select statement

Postby nageswaragunupudi » Mon Mar 30, 2020 4:19 pm

With FWH MariaDB, it is not necessary to hard code all the values
Code: Select all  Expand view
xTARIH = CTOD("30/03/2020")
cSql := "SELECT * FROM ajanda WHERE BAGNO BETWEEN ? AND ? AND AJ_BTAR >= ? AND AJ_TARIH <= ?"

oRs := oCn:RowSet( cSql, { "HY00000000", "HY99999999", xTARIH } )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10631
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Help for sql select statement

Postby Horizon » Mon Mar 30, 2020 6:19 pm

Thank you Mr. Rao.
Horizon
 
Posts: 1322
Joined: Fri May 23, 2008 1:33 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: RSalazarU and 45 guests