FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help for sql select statement
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM

Help for sql select statement

Posted: Mon Mar 30, 2020 02:42 PM
Hi,

I have this code:
Code (fw): Select all Collapse
        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.06
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Help for sql select statement

Posted: Mon Mar 30, 2020 04:11 PM
Code (fw): Select all Collapse
SELECT * FROM ajanda WHERE BAGNO BETWEEN 'HY00000000' AND 'HY99999999' AND AJ_BTAR >= '2020-03-30' AND AJ_TARIH <= '2020-03-30'


OR

Code (fw): Select all Collapse
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
Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM

Re: Help for sql select statement

Posted: Mon Mar 30, 2020 04:19 PM
With FWH MariaDB, it is not necessary to hard code all the values
Code (fw): Select all Collapse
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
Posts: 1387
Joined: Fri May 23, 2008 01:33 PM

Re: Help for sql select statement

Posted: Mon Mar 30, 2020 06:19 PM

Thank you Mr. Rao.

Regards,



Hakan ONEMLI



Harbour & MSVC 2022 & FWH 23.06

Continue the discussion