Help for sql select statement

Post Reply
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

Help for sql select statement

Post by Horizon »

Hi,

I have this code:

Code: Select all

        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 & VS 2019 & FWH 20.12
User avatar
nageswaragunupudi
Posts: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Help for sql select statement

Post by nageswaragunupudi »

Code: Select all

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

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: 8017
Joined: Sun Nov 19, 2006 5:22 am
Location: India
Contact:

Re: Help for sql select statement

Post by nageswaragunupudi »

With FWH MariaDB, it is not necessary to hard code all the values

Code: Select all

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
Horizon
Posts: 997
Joined: Fri May 23, 2008 1:33 pm

Re: Help for sql select statement

Post by Horizon »

Thank you Mr. Rao.
Post Reply