select primary_flag from tc_contact where primary_flag !=0

select dept_id,dept_name,tree_level,tree_path from tc_department where
org_id=1 and stop_flag=0 order by tree_path --部门显示

SELECT * FROM TC_CONTACT where ACCOUNT_ID=1246968 --主视图
select * from TCV_CONTACT where ACCOUNTID=1246968 --联系人
select * from TCV_OPPORTUNITY where ACCOUNTID=1246968 --销售机会
select * from TCV_ACTIVITY where ACCOUNTID=1246968 --销售行动

SELECT count(t.yckb_id) --参课判定

FROM tcu_yckb t
inner join tc_contact tc
on t.yckb_refid01 = tc.contact_id
and tc.org_id = t.org_id
inner join tcu_jiaoxplan jp
on t.yckb_refid02 = jp.jiaoxplan_id
and t.org_id = jp.org_id
inner join tc_account khb
on tc.account_id = khb.account_id
and khb.org_id = tc.org_id
where t.yckb_int05 = 1001 -- 参课判定:参加
and t.qrcode = 'EDC5903AFE4A8777';

SELECT * from tcu_yckb where qrcode = 'EDC5903AFE4A8777' for update;
SELECT * from tcu_yckb where yckb_name like '%盛景网联测试客户八-王小梦-创新梦工厂 - 21%' for update --9992901D98300000
16:45:45
/mg叶子/mg 2015/5/11 16:45:45
select yckb_id, qrcode, yckb_int06
from tcu_yckb
where qrcode = '9992901D98308888';

select * from tc_contact where contact_name = '梁广永'; --记住是contact_ID 还有一个contract_ID D69D5FC04BF35555 9192901D98308888 E279CF6AF9BF01F7
select * from tcu_yckb order by create_time desc --where qrcode is not null
select * from tcu_yckb where yckb_refid01= 195166
select * from tcu_yckb where yckb_id = 416804 for update -- D69D5FC04BF3C5F0 yckb_refid01= 199933 and


--正式课的签到时间
select * from tcu_jiaoxplan where jiaoxplan_name='投资俱乐部2015-3'; --投资俱乐部2015-3
select * from esi_validcontrol --6628
for update

insert into esi_validcontrol values('6668','2015/4/29 10:23:39','12284','2015/4/29 10:23:39',0,0)

select yckb_id,
yckb_name,
qrcode,
yckb_int03,
yckb_int06,
decode(yckb_int03, 1002, '是', 1001, '否 ') as "签到状态"
from tcu_yckb
where qrcode in('D69D5FC04BF35555','9192901D98308888','9992901D98308888','EDC5903AFE4A6666','EDC5903AFE4A8777','9992901D98309999');

update tcu_yckb set yckb_int03 = 1002 where qrcode in('EDC5903AFE4A8777'); --设置指定code成已签到
update tcu_yckb set yckb_int03 = 1001 where qrcode in('EDC5903AFE4A8777'); --设置指定code成未签到

select t.yckb_int06,decode(t.yckb_int06, 1001, '是' , 1002, '否', 1003, '无名片') "有效到场/合格总裁"
from tcu_yckb t where qrcode = '9992901D98308888';
select yckb_int06 from tcu_yckb t where qrcode = '9992901D9830888812';

select yckb_int06 from tcu_yckb t where qrcode = 'EDC5903AFE4A8777';

tcu_yckb

select count(yckb_id)

from tcu_yckb
where qrcode = 'EDC5903AFE4A8777';

 

 

 

--盛景网联APP签到系统讨论组 给他们更新字段的语句
select yckb_id,
yckb_name,
qrcode,
yckb_int03,
yckb_int06,
decode(yckb_int03, 1002, '是', 1001, '否 ') as "签到状态"
from tcu_yckb
where qrcode in('EDC5903AFE4A8777','EDC5903AFE4A6666','9992901D98308888');

update tcu_yckb set yckb_int03 = 1001 where qrcode in('9992901D98308888');

--更改未收款金额的代码 19800 ==> 0

select * from tc_contract

select contract_unpayed_amount from tc_contract where account_ID=1246968 for update

select account_ID from tcu_yckb where qrcode in('EDC5903AFE4A8777','EDC5903AFE4A6666');



--没找到符合条件的签到表。
SELECT count(t.yckb_id)
FROM tcu_yckb t
inner join tc_contact tc
on t.yckb_refid01 = tc.contact_id
and tc.org_id = t.org_id
inner join tcu_jiaoxplan jp
on t.yckb_refid02 = jp.jiaoxplan_id
and t.org_id = jp.org_id
inner join tc_account khb
on tc.account_id = khb.account_id
and khb.org_id = tc.org_id
where
-- jp.jiaoxplan_date01 >= trunc(sysdate)
-- and (trunc(jp.jiaoxplan_date02 + 1) - 1 / 24 / 60 / 60) > sysdate

-- 当前日期>=报到日(开课日期前一天)0点,其当前日期<=结课日期的23:59:59
jp.jiaoxplan_date01 - 1 <= trunc(sysdate)
and trunc(jp.jiaoxplan_date02 + 1) - 1 / 24 / 60 / 60 >= sysdate
and t.yckb_int03 = 1001 -- 签到状态:否
-- and t.yckb_type = 2136 -- 正式课
and t.yckb_int05 = 1001 -- 参课判定:参加
and t.qrcode = 'EDC5903AFE4A8777';


--教学计划表 修改有效签到时间 也可以改一下那个会的时间 然后在vs运行一下网站设置 注:会议已经结束
select * from tcu_jiaoxplan where jiaoxplan_name = '投资俱乐部2015-3'
select * from tcu_jiaoxplan where jiaoxplan_name = '总裁年会-第八届'
select * from esi_validcontrol for update --2015/4/30 10:23:30

--相应的学习计划
select tb.yckb_id from tcu_yckb tb where tb.qrcode = '9992901D98308888' for update --416788
SELECT count(t.ref_1)
from tcu_yckb_1_1
where yckb_id = qdID;

--给这几个人发短信
select * from esi_recipient

 

 

select dept_id,dept_name,tree_level,tree_path from tc_department
where org_id=1 and stop_flag=0 order by tree_path

select * from tcv_contact where accountID=1246968 --NAME like'%zyl%'

select * from tcv_opportunity where accountID=1246968
select * from tcv_contact order by modifiedtime desc

select * from tc_contact order by create_time desc

select t.*, t.rowid from SJ_ACTIVITYSTAGECONFIGURE t

select * from tcv_account_attrs where label like'%股权投资经验%'

select * from tc_audit_stage_define

select * from tcu_basicpdu where basicpdu_name like '%投资导师%'

select * from tc_type where org_id=1 and obj_type=4
--合作伙伴开发销售机会 04
--老客户销售机会 10003
select stage_id,stage_name,stage_type from tc_opportunity_stage where org_id=1 and type_id=2048
--客户开发销售机会 10001
select stage_id,stage_name,stage_type from tc_opportunity_stage where org_id=1 and type_id=2
--邀约机会 10006
select stage_id,stage_name,stage_type from tc_opportunity_stage where org_id=1 and type_id=2241

select * from tc_opportunity_stage where org_id=1 and type_id=2
--224 私人顾问投资导师 825 销售增长计划实操班 712 明星产品实操班

/* 客户开发销售机会
2889294 P0-目标客户开发
1355 P1-建立信赖
1365 P2-挖掘需求
2889301 P3-价值塑造
105 P4-异议处理
113 P5-赢取承诺(回执)
119 P6-促成收款
126 P7-确认到场

邀约机会
Y1:客户分析与策略 5332444
Y2:建立信赖 5332437
Y3: 挖掘需求 5332428
Y4塑造价值 5332418
Y5: 异议处理 5332399
Y6:赢取承诺 5332392
Y7: 签到 5332409

老客户销售机会
S1:客户分析与策略 5332352
S2 :建立信赖 5332375
S3:挖掘需求 5332370
S4:塑造价值 5332360
S5:异议处理 5332357
S6:赢取承诺 5332354
S7:成交 5332353
*/
S2 tc_account.acct_int05,tc_account.billing_address,tc_account_attr.acct_multi16,tc_account_attr.acct_multi17,tc_account.acct_date08,tc_account.acct_int07,tc_account.acct_int13,tc_account.acct_int17,tc_account.acct_int18,tc_account.acct_char01,tc_account.acct_char02,tc_account.acct_multi06,tc_account_xattr.acct_int50
S3 缺少可调度资金 tc_account_xattr.acct_int51,tc_account_attr.acct_multi08,tc_account_xattr.acct_int53,tc_account_xattr.acct_int52,tc_account_xattr.acct_int54,tc_account_xattr.acct_int55,tc_account_xattr.acct_int56,tc_account_xattr.acct_int57
S4 tc_account_xattr.acct_int58,tc_account_xattr.acct_int59,tc_account_xattr.acct_int60,tc_account_xattr.acct_int61,tc_account_xattr.acct_int62,tc_account_xattr.acct_int63,tc_account_xattr.acct_int64,tc_account_1_1.int_1,tc_account_1_1.int_2,tc_account_1_1.int_3
S5 tc_account_1_1.int_4
tc_account_1_1.int_5,tc_account_attr.acct_multi18,tc_account_1_1.txt_4

select * from tcv_account_attrs where label like'%家庭年收入%'

/*
项目亮点 projecttarget
核心客户 keycustomers
企业核心关注点 concernedpoints
家庭年收入 income
投资性房产 houseproperty
理财产品 financialproducts
股票 stock
小额贷 loan
股权投资经验 investmentexperience
在风险可控的前提下,5年内期望回报的倍数 expected eturn
是否有明确的资产配置需求 ifassetrequirement
是否有中长期股权投资理念 ifequityinvestment
是否听过股权选修课 ifoptionalcourse
是否了解母基金的运作模式 ifknowfund
是否参加过基金募集 iffundraising
是否对发布的某支母基金动过心 ifinterestedfund
是否知道要投母基金要购买投资导师 ifconditionoffund
是否知道投资导师的内容价值和价格 ifknowvalue
大区是否提前介入沟通 ifcommunication
是否谈过投资导师 ifcourse
客户抗拒点 ifcustomerpoint
财务电话 financalnumber
财务姓名 financalname
微信号 wechatnumber
收入平均增长率 growthrate
销售方式 salesmode
公司产品的规划思路和竞争策略 companyplan
是否有各类产品的CDBFA ifproductinfo
*/