can u please combine all below querys and give ot put of BHBilling Start Date…
- User
can u please combine all below querys and give ot put of BH_Billing Start Date (MM/DD/YYY) BH_Site_Name BH_IMSI BH_Additional_IMSI BH_APN BH_Product Offering ID
=============================BILLING_START_DATE==================================================
select distinct dp.account_no DP_Acct_no,a.account_no SC_ACCT_NO, TO_CHAR(FROM_TZ(CAST(TO_TIMESTAMP_TZ('01-Jan-1970 00:00:00 GMT', 'DD-MON-YYYY HH24:MI:SS TZR')+(pp.instantiated_t/86400) AS TIMESTAMP), 'GMT') AT TIME ZONE 'EUROPE/Sofia', 'mm/dd/YYYY') as activation_date, REGEXP_REPLACE(pt.name,' (ARR|ADV|AdvP)$','', 1, 0,'i') AS product_name from pin.service_T s,pin.purchased_product_t pp,pin.plan_t pt ,pin.account_t a,pin.billinfo_T b,pin.billinfo_t ban, pin.account_t dp where a.poid_id0=b.account_obj_id0 and b.ar_billinfo_obj_id0=ban.poid_id0 and ban.account_obj_id0=dp.poid_id0 and s.poid_id0=pp.service_obj_id0 and s.account_obj_id0=a.poid_id0 and pp.account_obj_id0=a.poid_id0 and s.poid_id0=pp.service_obj_id0 and pp.plan_obj_id0=pt.poid_id0 and pp.plan_obj_id0=pt.poid_id0 and pp.status=1 and a.account_no in ('SC-0000020527');
=============================BH_Site_Name==================================================
select distinct s.login,s.status,sa.site_ref_id SITENAME,s.poid_id0 from pin.account_t a,pin.service_T s,pin.service_telco_gprs_oneweb_t sa where a.poid_id0=s.account_obj_id0 and s.poid_id0=sa.obj_id0 and a.account_no in ('SC-0000020527');
=============================BH_IMSI=======================================================
SELECT DISTINCT A.ACCOUNT_NO, SA.NAME, SA.REC_ID, S.STATUS FROM PIN.SERVICE_T S, PIN.SERVICE_ALIAS_LIST_T SA, PIN.ACCOUNT_T A WHERE S.POID_ID0 = SA.OBJ_ID0 AND S.ACCOUNT_OBJ_ID0 = A.POID_ID0 AND SA.REC_ID = 0 ---AND S.STATUS = 10100 and a.account_no in ('SC-0000020527');
=============================BH_Additional_IMSI=======================================================
SELECT DISTINCT A.ACCOUNT_NO, SA.NAME, SA.REC_ID, S.STATUS FROM PIN.SERVICE_T S, PIN.SERVICE_ALIAS_LIST_T SA, PIN.ACCOUNT_T A WHERE S.POID_ID0 = SA.OBJ_ID0 AND S.ACCOUNT_OBJ_ID0 = A.POID_ID0 AND SA.REC_ID = 1 ---AND S.STATUS = 10100 and a.account_no in ('SC-0000020527');
=============================BH_APN======================================================
SELECT DISTINCT A.ACCOUNT_NO, SA.APN,S.STATUS FROM PIN.SERVICE_T S, PIN.service_telco_gprs_oneweb_t SA, PIN.ACCOUNT_T A WHERE S.POID_ID0 = SA.OBJ_ID0 AND S.ACCOUNT_OBJ_ID0 = A.POID_ID0 ---AND S.STATUS = 10100 and a.account_no in ('SC-0000020527');
============================Product Offering ID===========================================
SELECT DP.ACCOUNT_NO "DP_ACCOUNT_NO",A.ACCOUNT_NO AS "SC_ACCOUNT_NO", -- TRUNC(CAST(DATE '1970-01-01' + ( 1 / 24 / 60 / 60 ) * A.CREATED_T AS TIMESTAMP)) AS "ACTIVATION DATE", TO_CHAR(FROM_TZ(CAST(TO_TIMESTAMP_TZ('01-JAN-1970 00:00:00 GMT', 'DD-MON-YYYY HH24:MI:SS TZR') + (pp.cycle_start_t / 86400) AS TIMESTAMP), 'GMT') AT TIME ZONE 'UTC', 'YYYY-MM-DD') CYCLE_START_T, TO_CHAR(FROM_TZ(CAST(TO_TIMESTAMP_TZ('01-JAN-1970 00:00:00 GMT', 'DD-MON-YYYY HH24:MI:SS TZR') + (pp.cycle_end_t / 86400) AS TIMESTAMP), 'GMT') AT TIME ZONE 'UTC', 'YYYY-MM-DD') CYCLE_END_T, PP.STATUS PRODUCT_STATUS, --DECODE(PP.STATUS,1,'ACTIVE',2,'CANCELLED',3,'cLOSED') PRODUCT_STATUS, REGEXP_REPLACE(S.PRODUCT_OFFERING_ID ,' (ARR|ADV|AdvP)$','', 1, 0,'i') AS PRODUCT_OFFERING_ID FROM pin.account_t a,pin.billinfo_T b,pin.billinfo_t ban, pin.account_t dp, PIN.PURCHASED_PRODUCT_T PP,PIN.PLAN_T P, PIN.SERVICE_TELCO_GPRS_ONEWEB_T S WHERE a.poid_id0=b.account_obj_id0 and b.ar_billinfo_obj_id0=ban.poid_id0 and ban.account_obj_id0=dp.poid_id0 AND A.POID_ID0 = PP.ACCOUNT_OBJ_ID0 AND PP.PLAN_OBJ_ID0 = P.POID_ID0 AND S.OBJ_ID0 = PP.SERVICE_OBJ_ID0 AND a.account_no in ('SC-0000020527') AND A.BUSINESS_TYPE = 4000 ORDER BY A.ACCOUNT_NO;
- Assistant
Integrating multiple SQL queries into a combined query requires understanding of how each query relates to the others. This task generally involves joining tables based on common fields. Below is a combined version of the provided queries that considers fields like
account_noandpoid_id0for constructing required joins. Make sure to adapt the join conditions based on actual data relationships if needed, as this is a theoretical integration without access to your database schema.sqlSELECT -- Fields from BH_Billing Start Date TO_CHAR( FROM_TZ(CAST(TO_TIMESTAMP_TZ('01-Jan-1970 00:00:00 GMT', 'DD-MON-YYYY HH24:MI:SS TZR') + (pp.instantiated_t / 86400) AS TIMESTAMP), 'GMT') AT TIME ZONE 'EUROPE/Sofia', 'mm/dd/YYYY' ) AS BH_Billing_Start_Date, REGEXP_REPLACE(pt.name,' (ARR|ADV|AdvP)$','', 1, 0,'i') AS Product_Offering_ID,