PB数据窗口中SQL语句动态LIKE后边加参数如何加?

数据窗口中SQL语句like后加参数如何写?
2024-12-03 12:47:00
推荐回答(4个)
回答1:

SELECT pos_checkin.checkindate,
pos_checkin.memno,
pos_checkin.name,
mem_member.memberkind,
pos_sales.itemcode,
pos_sales.itemname1,
pos_sales.saleprice,
pos_sales.quantity,
pos_sales.totalpayable,
pos_sales.sale_kinds,
pos_sales.parent_kinds,
pos_bills.serverno
FROM pos_sales,
pos_checkin,
pos_bills,
mem_member
WHERE pos_bills.billcode = pos_sales.billcode and
pos_checkin.checkin_id = pos_sales.checkin_id and
pos_checkin.memno = mem_member.m_id and
pos_checkin.checkindate >= :adt_date1 AND
pos_checkin.checkindate <= :adt_date2 AND
pos_bills.rec_status = '1' AND
pos_checkin.rec_status = '1' AND
pos_bills.billtype = '0' AND
pos_bills.bill_status = '1' AND
pos_sales.rec_status = '1' AND
pos_sales.sale_type <> '2' AND
pos_sales.if_import = '0' AND
(isnull(:ai_memkind,0) = 0 or mem_member.memberkind = :ai_memkind) AND
pos_sales.parent_kinds like '%'+:as_salekind+'%'

回答2:

like后面可以实现模糊查询 它与通配符一起使用
SQL中的通配符中有下面四种:
% ;
_ ;
[ ] ;
[^]

回答3:

例:
假设字段为字符型
参数为字符型:as_parm
1.精确查询,跟等号一样
select * from tablename where 字段名 like :as_parm
2.模糊查询:
select * from tablename where 字段名 like :as_parm 数据窗口语句不变,在数据窗口传参数的时候处理
string ls_parm
ls_parm=....
ls_parm=ls_parm+'%'
dw_1.retrieve(ls_parm)

回答4:

第一次听说此数据库!Sorry