( tt.comname, tt.unitname )
as unitname,
tt.refereecode,
tt.insuretype, tt.starteffectdate, tt.endeffectdate, tt.uniagentcode, tt.unisaleschannel
, tt.unisalesbusitype
FROM (
SELECT vip.NAME, vip.sex, vip.idcardtype, vip.idcard, vip.mobile
, vip.birthday, acc.ID, acc.vipid
, CASE
WHEN acc.cardno IS NULL THEN acc.changecardno
ELSE acc.cardno
END AS cardno, acc.cardtypename, acc.cardtypecode, acc.gradetypename, acc.status
, acc.TYPE, acc.changecardno, acc.changecardnoflag, acc.PASSWORD, acc.accountmoneytype
, acc.networktype, acc.usertype, mon.money, mon.points
, CASE
WHEN cp.couponcnt IS NULL THEN 0
ELSE cp.couponcnt
END AS couponcnt
, (
SELECT COUNT(0)
FROM vip_accountrelated T
WHERE T.vipid =
vip.ID
AND T.accountid =
acc.ID
AND T.dr =
0
) AS relatedcnt
, (
SELECT t1.unit_name::VARCHAR
FROM up_org_unit t1, up_org_unit_ext t2
WHERE t1.unit_id =
t2.unit_id
AND t2.unit_uncode =
vip.unitid
) AS unitname
, (
SELECT t1.unit_name::VARCHAR
FROM up_org_unit t1, up_org_unit_ext t2
WHERE t1.unit_id =
t2.unit_id
AND t2.unit_uncode =
acc.sendunitid
) AS comname, acc.refereecode, vip.insuretype, acc.starteffectdate, acc.endeffectdate
, acc.uniagentcode, acc.unisaleschannel, acc.unisalesbusitype
FROM VIP_ACCOUNT acc, VIP_INFO vip, VIP_ACCOUNTMONEY mon, (
SELECT ac.accountid, COUNT(0) AS couponcnt
FROM VIP_ACCOUNTCOUPON ac, VIP_COUPON cou
WHERE ac.couponcode =
cou.code
AND cou.status =
1
AND ac.dr =
0
AND cou.dr =
0
GROUP BY ac.accountid
) cp
WHERE acc.vipid =
vip.ID
AND acc.ID =
mon.ID
AND acc.ID =
cp.accountid
AND acc.dr =
0
AND vip.dr =
0
AND mon.dr =
0
) tt
ORDER BY tt.usertype OFFSET ( ?-
1 ) * ?
LIMIT ?
推荐一个网址:产看pgsql常用的函数:
https://www.cnblogs.com/personblog/p/11042105.html
No function matches the given name and argument types. You might need to add explicit type casts postgrepsql数据库
标签:net code div eps flag hda vip order 数据库