Display data from two tables based on date criteria
Hi allI have two tables, using these two tables and a few conditions I want to recover under result. Oracle version is (Oracle9i Enterprise Edition Release 9.2.0.8.0 - 64 bit Production)
LOGON_ID USER_ID LOGON_TIME LOGON_TYPE SUBSCRIBER_NO CUSTOMER_ID
26063548 4528890298 4/5/2010 12:03:58 AM MSISDN GSM04528890298 581751708
logon_histories_r table records the information of each user who connects to the system. Subscriber Details table contains all the information corresponding to subscriber_no, only 1 row should be returned.I'm confused usage date condition for the table of the Subscriber, the input parameter date 04/04/2006 to 15/04/06
Select lh.logon_id, lh.user_id, lh.logon_time, lh.logon_type, subs.subscriber_no, subs.customer_id
of logon_histories_r lh, subscribed subs
where lh.logon_time > = to_date('05-04-2010','dd-mm-yyyy')--to_date('04-04-2006','dd-mm-yyyy')
and lh.logon_time < to_date('06-04-2010','dd-mm-yyyy')--to_date('15-01-2007','dd-mm-yyyy')
and lh.user_id = substr (subs.subscriber_no,-10);
If the date range is 04/05/2010 to 04/06/2010 then the data related to the BAN 581751708 must be the result,
If the date range is 04/04/2006 to 15/01/2007 data related to the BAN 502499502 must be the result.
Please find DDL and data relevant to these results. There are millions of records of Subscriber & logon_histories_r table, I am given appropriate providing a subscriber_id.
CREATE TABLE LOGON_HISTORIES_R
(
LOGON_ID NUMBER(12) NOT NULL,
USER_ID VARCHAR2(15 BYTE) NOT NULL,
LOGON_TIME DATE NOT NULL,
LOGOUT_TIME DATE,
LOGOUT_METHOD VARCHAR2(15 BYTE),
LOGON_TYPE VARCHAR2(15 BYTE) DEFAULT 'MSISDN'
);
CREATE TABLE SUBSCRIBER
(
SUBSCRIBER_NO VARCHAR2(20 BYTE) NOT NULL,
CUSTOMER_ID NUMBER(9) NOT NULL,
SYS_CREATION_DATE DATE NOT NULL,
SYS_UPDATE_DATE DATE,
OPERATOR_ID NUMBER(9),
APPLICATION_ID CHAR(6 BYTE),
DL_SERVICE_CODE CHAR(5 BYTE) NOT NULL,
DL_UPDATE_STAMP NUMBER(4),
EFFECTIVE_DATE DATE NOT NULL,
INIT_ACTIVATION_DATE DATE NOT NULL,
SUB_STATUS CHAR(1 BYTE) NOT NULL,
SUB_STATUS_DATE DATE NOT NULL,
ORIGINAL_INIT_DATE DATE NOT NULL,
SUB_STATUS_LAST_ACT CHAR(3 BYTE),
SUB_STATUS_RSN_CODE CHAR(4 BYTE),
PRODUCT_TYPE CHAR(3 BYTE),
CUSTOMER_BAN NUMBER(9),
CTN_SEQ_NO NUMBER(9),
REQ_ST_GRACE_PERIOD DATE,
REQ_END_GRACE_PERIOD DATE,
COMMIT_START_DATE DATE,
COMMIT_END_DATE DATE,
COMMIT_REASON_CODE CHAR(3 BYTE),
COMMIT_ORIG_NO_MONTH NUMBER(3),
SUSP_RC_RATE_TYPE CHAR(1 BYTE),
CONTRACT_NO VARCHAR2(10 BYTE),
CNT_SEQ_NO NUMBER(9),
DEALER_CODE CHAR(5 BYTE),
ORG_DEALER_CODE CHAR(5 BYTE),
SALES_AGENT CHAR(5 BYTE),
ORG_SALES_AGENT CHAR(5 BYTE),
REQ_DEPOSIT_AMT NUMBER(13,2),
LEADING_NUMBER VARCHAR2(20 BYTE),
PABX_IND CHAR(1 BYTE),
NEXT_CTN VARCHAR2(20 BYTE),
NEXT_CTN_CHG_DATE DATE,
PRV_CTN VARCHAR2(20 BYTE),
PRV_CTN_CHG_DATE DATE,
NEXT_BAN NUMBER(9),
NEXT_BAN_MOVE_DATE DATE,
PRV_BAN NUMBER(9),
PRV_BAN_MOVE_DATE DATE,
SUB_STS_ISSUE_DATE DATE,
ACTIVATE_WAIVE_RSN CHAR(6 BYTE),
EARLIEST_ACTV_DATE DATE,
SUB_ACTV_LOCATION CHAR(4 BYTE),
CUST_WATCH_LMT NUMBER(11,2),
CUST_WATCH_DATE DATE,
BASIC_WATCH_LMT NUMBER(11,2),
CREDIT_WATCH_PIN_CD NUMBER(4),
SUB_MARKET_CODE CHAR(3 BYTE) NOT NULL,
LIMIT_RESERVED_DAYS NUMBER(4),
FF_EXPIRATION_DATE DATE,
FLEX_IND CHAR(1 BYTE),
DUO_IND CHAR(1 BYTE),
LISTED_IND CHAR(1 BYTE),
SUB_DEPARTMENT_CD CHAR(4 BYTE),
LAST_SUBS_DISC_DT DATE,
LAST_SUBS_DISC_DT_UD DATE,
LAST_SUBSCR_DISC_SN NUMBER(3),
LAST_SUBSCR_DISC_SN_UD NUMBER(3),
PNI VARCHAR2(10 BYTE),
RMS_REF_STORE_ID CHAR(4 BYTE),
RMS_REF_TYPE CHAR(1 BYTE),
RMS_REF_OD NUMBER(9),
DLR_ACT_FEE NUMBER(11,2),
PREP_AMOUNT NUMBER(11,2),
SUBSCRIBER_ID NUMBER(9) NOT NULL,
SUB_LANG CHAR(2 BYTE),
SMS_RCV_STYLE_CODE CHAR(2 BYTE),
CONV_RUN_NO NUMBER(3),
ALLOW_ADVERTISING_IND CHAR(1 BYTE),
IVR_WRONG_ACCESS_NO NUMBER(2),
THRESHOLD_AMT NUMBER(11,2),
PUBLISH_LEVEL CHAR(30 BYTE),
AUTO_RELEASE_IND CHAR(1 BYTE),
CUST_WATCH_EFF_DATE DATE,
CUST_WATCH_EXP_DATE DATE,
OPERATOR_CW_LMT NUMBER(11,2),
SEND_SMS_FOR_MATCH CHAR(1 BYTE),
CPS_STATUS CHAR(1 BYTE),
CPS_TRANSACTION NUMBER(3),
CPS_TYPE NUMBER(3),
ISP_PASS VARCHAR2(30 BYTE),
ISP_TYPE CHAR(2 BYTE),
OPERATOR_TMP_DATE DATE,
OPERATOR_TMP_LMT NUMBER(11,2),
SUB_ORG_CD CHAR(10 BYTE),
ORG_MEMBER_NO VARCHAR2(20 BYTE)
);
Insert into LOGON_HISTORIES_R
(LOGON_ID, USER_ID, LOGON_TIME, LOGOUT_TIME, LOGOUT_METHOD, LOGON_TYPE)
Values
(26063548, '4528890298', TO_DATE('04/05/2010 00:03:58', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('04/05/2010 00:06:58', 'MM/DD/YYYY HH24:MI:SS'), NULL,
'MSISDN');
Insert into logon_histories_r
(LOGON_ID, USER_ID, LOGON_TIME, LOGOUT_TIME, LOGOUT_METHOD, LOGON_TYPE)
Values
(2649592, '4528890298', TO_DATE('04/10/2006 19:19:20', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('04/10/2006 19:19:48', 'MM/DD/YYYY HH24:MI:SS'), 'TIMEOUT',
'MSISDN');
Insert into SUBSCRIBER
(SUBSCRIBER_NO, CUSTOMER_ID, SYS_CREATION_DATE, SYS_UPDATE_DATE, OPERATOR_ID, APPLICATION_ID, DL_SERVICE_CODE, DL_UPDATE_STAMP, EFFECTIVE_DATE, INIT_ACTIVATION_DATE, SUB_STATUS, SUB_STATUS_DATE, ORIGINAL_INIT_DATE, SUB_STATUS_LAST_ACT, SUB_STATUS_RSN_CODE, PRODUCT_TYPE, CUSTOMER_BAN, CTN_SEQ_NO, REQ_ST_GRACE_PERIOD, REQ_END_GRACE_PERIOD, COMMIT_START_DATE, COMMIT_END_DATE, COMMIT_REASON_CODE, COMMIT_ORIG_NO_MONTH, SUSP_RC_RATE_TYPE, CONTRACT_NO, CNT_SEQ_NO, DEALER_CODE, ORG_DEALER_CODE, SALES_AGENT, ORG_SALES_AGENT, REQ_DEPOSIT_AMT, LEADING_NUMBER, PABX_IND, NEXT_CTN, NEXT_CTN_CHG_DATE, PRV_CTN, PRV_CTN_CHG_DATE, NEXT_BAN, NEXT_BAN_MOVE_DATE, PRV_BAN, PRV_BAN_MOVE_DATE, SUB_STS_ISSUE_DATE, ACTIVATE_WAIVE_RSN, EARLIEST_ACTV_DATE, SUB_ACTV_LOCATION, CUST_WATCH_LMT, CUST_WATCH_DATE, BASIC_WATCH_LMT, CREDIT_WATCH_PIN_CD, SUB_MARKET_CODE, LIMIT_RESERVED_DAYS, FF_EXPIRATION_DATE, FLEX_IND, DUO_IND, LISTED_IND, SUB_DEPARTMENT_CD, LAST_SUBS_DISC_DT, LAST_SUBS_DISC_DT_UD, LAST_SUBSCR_DISC_SN, LAST_SUBSCR_DISC_SN_UD, PNI, RMS_REF_STORE_ID, RMS_REF_TYPE, RMS_REF_OD, DLR_ACT_FEE, PREP_AMOUNT, SUBSCRIBER_ID, SUB_LANG, SMS_RCV_STYLE_CODE, CONV_RUN_NO, ALLOW_ADVERTISING_IND, IVR_WRONG_ACCESS_NO, THRESHOLD_AMT, PUBLISH_LEVEL, AUTO_RELEASE_IND, CUST_WATCH_EFF_DATE, CUST_WATCH_EXP_DATE, OPERATOR_CW_LMT, SEND_SMS_FOR_MATCH, CPS_STATUS, CPS_TRANSACTION, CPS_TYPE, ISP_PASS, ISP_TYPE, OPERATOR_TMP_DATE, OPERATOR_TMP_LMT, SUB_ORG_CD, ORG_MEMBER_NO)
Values
('GSM04528890298', 110069191, TO_DATE('12/04/2001 17:06:17', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/01/2004 22:42:49', 'MM/DD/YYYY HH24:MI:SS'), NULL,
'FUTRX ', 'CS016', NULL, TO_DATE('01/02/2004 00:08:32', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/31/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'C', TO_DATE('01/02/2004 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('07/31/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CAN', 'CNP3',
'GSM', 110069191, 7013986, NULL, NULL,
TO_DATE('07/31/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/31/2001 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PPD', 6, NULL,
NULL, 1008631, 'DCNV ', 'DCNV ', 'DFLT ',
'DFLT ', 0, NULL, 'S', NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, TO_DATE('01/02/2004 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, TO_DATE('07/31/2000 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'TEMO', 0, NULL, 0, NULL,
'TEL', NULL, NULL, 'N', 'N',
'Y', NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
0, 0, 8635, 'DK', '01',
1, 'N', NULL, 0, '1234',
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
Insert into SUBSCRIBER
(SUBSCRIBER_NO, CUSTOMER_ID, SYS_CREATION_DATE, SYS_UPDATE_DATE, OPERATOR_ID, APPLICATION_ID, DL_SERVICE_CODE, DL_UPDATE_STAMP, EFFECTIVE_DATE, INIT_ACTIVATION_DATE, SUB_STATUS, SUB_STATUS_DATE, ORIGINAL_INIT_DATE, SUB_STATUS_LAST_ACT, SUB_STATUS_RSN_CODE, PRODUCT_TYPE, CUSTOMER_BAN, CTN_SEQ_NO, REQ_ST_GRACE_PERIOD, REQ_END_GRACE_PERIOD, COMMIT_START_DATE, COMMIT_END_DATE, COMMIT_REASON_CODE, COMMIT_ORIG_NO_MONTH, SUSP_RC_RATE_TYPE, CONTRACT_NO, CNT_SEQ_NO, DEALER_CODE, ORG_DEALER_CODE, SALES_AGENT, ORG_SALES_AGENT, REQ_DEPOSIT_AMT, LEADING_NUMBER, PABX_IND, NEXT_CTN, NEXT_CTN_CHG_DATE, PRV_CTN, PRV_CTN_CHG_DATE, NEXT_BAN, NEXT_BAN_MOVE_DATE, PRV_BAN, PRV_BAN_MOVE_DATE, SUB_STS_ISSUE_DATE, ACTIVATE_WAIVE_RSN, EARLIEST_ACTV_DATE, SUB_ACTV_LOCATION, CUST_WATCH_LMT, CUST_WATCH_DATE, BASIC_WATCH_LMT, CREDIT_WATCH_PIN_CD, SUB_MARKET_CODE, LIMIT_RESERVED_DAYS, FF_EXPIRATION_DATE, FLEX_IND, DUO_IND, LISTED_IND, SUB_DEPARTMENT_CD, LAST_SUBS_DISC_DT, LAST_SUBS_DISC_DT_UD, LAST_SUBSCR_DISC_SN, LAST_SUBSCR_DISC_SN_UD, PNI, RMS_REF_STORE_ID, RMS_REF_TYPE, RMS_REF_OD, DLR_ACT_FEE, PREP_AMOUNT, SUBSCRIBER_ID, SUB_LANG, SMS_RCV_STYLE_CODE, CONV_RUN_NO, ALLOW_ADVERTISING_IND, IVR_WRONG_ACCESS_NO, THRESHOLD_AMT, PUBLISH_LEVEL, AUTO_RELEASE_IND, CUST_WATCH_EFF_DATE, CUST_WATCH_EXP_DATE, OPERATOR_CW_LMT, SEND_SMS_FOR_MATCH, CPS_STATUS, CPS_TRANSACTION, CPS_TYPE, ISP_PASS, ISP_TYPE, OPERATOR_TMP_DATE, OPERATOR_TMP_LMT, SUB_ORG_CD, ORG_MEMBER_NO)
Values
('GSM04528890298', 502499502, TO_DATE('12/05/2006 15:55:13', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('01/12/2007 00:45:22', 'MM/DD/YYYY HH24:MI:SS'), NULL,
'FUTRX ', 'CS058', NULL, TO_DATE('01/12/2007 00:45:22', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/05/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'C', TO_DATE('01/12/2007 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('12/05/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CCN', 'NP ',
'GSM', 502499502, 14419730, NULL, NULL,
TO_DATE('12/05/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('06/04/2007 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PPD', 6, NULL,
'1035393', 6976424, '2311 ', '2311 ', 'DFLT ',
'DFLT ', NULL, '045', 'S', 'GSM04525210338',
TO_DATE('01/12/2007 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, NULL, NULL, NULL,
NULL, NULL, TO_DATE('01/12/2007 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, TO_DATE('12/05/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'TEMO', NULL, NULL, NULL, NULL,
'TEL', NULL, NULL, 'N', 'N',
'Y', NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, 6834900, 'DK', '01',
NULL, 'N', NULL, 9999999.99, '4321',
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
Insert into SUBSCRIBER
(SUBSCRIBER_NO, CUSTOMER_ID, SYS_CREATION_DATE, SYS_UPDATE_DATE, OPERATOR_ID, APPLICATION_ID, DL_SERVICE_CODE, DL_UPDATE_STAMP, EFFECTIVE_DATE, INIT_ACTIVATION_DATE, SUB_STATUS, SUB_STATUS_DATE, ORIGINAL_INIT_DATE, SUB_STATUS_LAST_ACT, SUB_STATUS_RSN_CODE, PRODUCT_TYPE, CUSTOMER_BAN, CTN_SEQ_NO, REQ_ST_GRACE_PERIOD, REQ_END_GRACE_PERIOD, COMMIT_START_DATE, COMMIT_END_DATE, COMMIT_REASON_CODE, COMMIT_ORIG_NO_MONTH, SUSP_RC_RATE_TYPE, CONTRACT_NO, CNT_SEQ_NO, DEALER_CODE, ORG_DEALER_CODE, SALES_AGENT, ORG_SALES_AGENT, REQ_DEPOSIT_AMT, LEADING_NUMBER, PABX_IND, NEXT_CTN, NEXT_CTN_CHG_DATE, PRV_CTN, PRV_CTN_CHG_DATE, NEXT_BAN, NEXT_BAN_MOVE_DATE, PRV_BAN, PRV_BAN_MOVE_DATE, SUB_STS_ISSUE_DATE, ACTIVATE_WAIVE_RSN, EARLIEST_ACTV_DATE, SUB_ACTV_LOCATION, CUST_WATCH_LMT, CUST_WATCH_DATE, BASIC_WATCH_LMT, CREDIT_WATCH_PIN_CD, SUB_MARKET_CODE, LIMIT_RESERVED_DAYS, FF_EXPIRATION_DATE, FLEX_IND, DUO_IND, LISTED_IND, SUB_DEPARTMENT_CD, LAST_SUBS_DISC_DT, LAST_SUBS_DISC_DT_UD, LAST_SUBSCR_DISC_SN, LAST_SUBSCR_DISC_SN_UD, PNI, RMS_REF_STORE_ID, RMS_REF_TYPE, RMS_REF_OD, DLR_ACT_FEE, PREP_AMOUNT, SUBSCRIBER_ID, SUB_LANG, SMS_RCV_STYLE_CODE, CONV_RUN_NO, ALLOW_ADVERTISING_IND, IVR_WRONG_ACCESS_NO, THRESHOLD_AMT, PUBLISH_LEVEL, AUTO_RELEASE_IND, CUST_WATCH_EFF_DATE, CUST_WATCH_EXP_DATE, OPERATOR_CW_LMT, SEND_SMS_FOR_MATCH, CPS_STATUS, CPS_TRANSACTION, CPS_TYPE, ISP_PASS, ISP_TYPE, OPERATOR_TMP_DATE, OPERATOR_TMP_LMT, SUB_ORG_CD, ORG_MEMBER_NO)
Values
('GSM04528890298', 581751708, TO_DATE('03/31/2010 19:10:33', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('04/01/2010 16:17:40', 'MM/DD/YYYY HH24:MI:SS'), 10077,
NULL, 'CS009', NULL, TO_DATE('03/31/2010 19:10:33', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'A', TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'NAC', 'CA ',
'GSM', 581751708, 24798333, NULL, NULL,
TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('09/29/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, 6, NULL,
NULL, 12093584, '2357 ', '2357 ', 'DFLT ',
'DFLT ', NULL, '045', 'S', NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, TO_DATE('03/31/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'TEMO', NULL, NULL, NULL, NULL,
'TEL', NULL, TO_DATE('12/31/4700 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'N', 'N',
'Y', NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, 9474437, 'DK', '01',
NULL, 'N', NULL, 999999999.99, '12',
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
Insert into SUBSCRIBER
(SUBSCRIBER_NO, CUSTOMER_ID, SYS_CREATION_DATE, SYS_UPDATE_DATE, OPERATOR_ID, APPLICATION_ID, DL_SERVICE_CODE, DL_UPDATE_STAMP, EFFECTIVE_DATE, INIT_ACTIVATION_DATE, SUB_STATUS, SUB_STATUS_DATE, ORIGINAL_INIT_DATE, SUB_STATUS_LAST_ACT, SUB_STATUS_RSN_CODE, PRODUCT_TYPE, CUSTOMER_BAN, CTN_SEQ_NO, REQ_ST_GRACE_PERIOD, REQ_END_GRACE_PERIOD, COMMIT_START_DATE, COMMIT_END_DATE, COMMIT_REASON_CODE, COMMIT_ORIG_NO_MONTH, SUSP_RC_RATE_TYPE, CONTRACT_NO, CNT_SEQ_NO, DEALER_CODE, ORG_DEALER_CODE, SALES_AGENT, ORG_SALES_AGENT, REQ_DEPOSIT_AMT, LEADING_NUMBER, PABX_IND, NEXT_CTN, NEXT_CTN_CHG_DATE, PRV_CTN, PRV_CTN_CHG_DATE, NEXT_BAN, NEXT_BAN_MOVE_DATE, PRV_BAN, PRV_BAN_MOVE_DATE, SUB_STS_ISSUE_DATE, ACTIVATE_WAIVE_RSN, EARLIEST_ACTV_DATE, SUB_ACTV_LOCATION, CUST_WATCH_LMT, CUST_WATCH_DATE, BASIC_WATCH_LMT, CREDIT_WATCH_PIN_CD, SUB_MARKET_CODE, LIMIT_RESERVED_DAYS, FF_EXPIRATION_DATE, FLEX_IND, DUO_IND, LISTED_IND, SUB_DEPARTMENT_CD, LAST_SUBS_DISC_DT, LAST_SUBS_DISC_DT_UD, LAST_SUBSCR_DISC_SN, LAST_SUBSCR_DISC_SN_UD, PNI, RMS_REF_STORE_ID, RMS_REF_TYPE, RMS_REF_OD, DLR_ACT_FEE, PREP_AMOUNT, SUBSCRIBER_ID, SUB_LANG, SMS_RCV_STYLE_CODE, CONV_RUN_NO, ALLOW_ADVERTISING_IND, IVR_WRONG_ACCESS_NO, THRESHOLD_AMT, PUBLISH_LEVEL, AUTO_RELEASE_IND, CUST_WATCH_EFF_DATE, CUST_WATCH_EXP_DATE, OPERATOR_CW_LMT, SEND_SMS_FOR_MATCH, CPS_STATUS, CPS_TRANSACTION, CPS_TYPE, ISP_PASS, ISP_TYPE, OPERATOR_TMP_DATE, OPERATOR_TMP_LMT, SUB_ORG_CD, ORG_MEMBER_NO)
Values
('GSM04528890298', 816370100, TO_DATE('09/03/2005 10:12:13', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('03/14/2006 12:20:09', 'MM/DD/YYYY HH24:MI:SS'), 14462,
NULL, 'CS016', NULL, TO_DATE('03/14/2006 12:20:08', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('09/03/2005 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'C', TO_DATE('03/14/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('09/03/2005 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'CAN', 'CNP3',
'GSM', 816370100, 12575966, NULL, NULL,
TO_DATE('09/03/2005 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), TO_DATE('03/02/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 'PPD', 6, NULL,
'690925', 3436964, '4243 ', '4243 ', 'DFLT ',
'DFLT ', NULL, '045', 'S', NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, TO_DATE('03/14/2006 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), NULL, TO_DATE('09/03/2005 00:00:00', 'MM/DD/YYYY HH24:MI:SS'),
'TEMO', NULL, NULL, NULL, NULL,
'TEL', NULL, NULL, 'N', 'N',
'Y', NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, 1436383, 'DK', '01',
NULL, 'N', NULL, 9999999.99, '0',
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL);
Hello
Welcome to the froum!
Thanks for posting the CREATE TABLE and INSERT! It's very nigra.
user12990691 wrote:
...
logon_histories_r table records the information of each user who connects to the system. Subscriber Details table contains all the information corresponding to subscriber_no, only 1 row should be returned.
Do you mean a line by the user, or a line every time that you run the report, regardless of the number of users connected during the period that interests us?
Anyway, if there are multiple logons, how do you decide that one? Or the output of logon_histories_r columns will be a sort of composite?
I'm confused usage date condition for the table of the Subscriber, the input parameter date 04/04/2006 to 15/04/06
Select lh.logon_id, lh.user_id, lh.logon_time, lh.logon_type, subs.subscriber_no, subs.customer_id
of logon_histories_r lh, subscribed subs
where lh.logon_time > = to_date('05-04-2010','dd-mm-yyyy')--to_date('04-04-2006','dd-mm-yyyy')
and lh.logon_time< to_date('06-04-2010','dd-mm-yyyy')="" --="">
and lh.user_id = substr (subs.subscriber_no,-10);
Must LH.LOGON_TIME match something in the subscruber table? If so, you need to addsome extra join pathological.
For example, if lh.logon_time must be between d1 and d2 (where d1 and d2 are DATE columns), then:
select lh.logon_id
, lh.user_id
, lh.logon_time
, lh.logon_type
, subs.subscriber_no
, subs.customer_id
from logon_histories_r lh
, subscriber subs
where lh.logon_time >= to_date ('05-04-2010','dd-mm-yyyy') -- to_date('04-04-2006','dd-mm-yyyy')
and lh.logon_time < to_date ('06-04-2010','dd-mm-yyyy') -- to_date('15-01-2007','dd-mm-yyyy')
and lh.user_id = substr (subs.subscriber_no, -10)
and lh.logon_time >= subs.d1 -- New condition added
and lh.logon_time <= subs.d2 -- New condition added
;
Please find DDL and data relevant to these results. There are millions of records of Subscriber & logon_histories_r table, I am given appropriate providing a subscriber_id.
That's smart, don't not post each row of the table: looks like you posted just enough to show what the problem is.
Try to do the same thing with the columns. Do not post every single column, just the columns that have something to do with the problem.
Tags: Database
Similar Questions
-
Extraction of data from two tables without discounting
Hi friends,
I have a problem I want to extract data from two tables without discount in the text field when I will enter any value in a text field, then the value of corressponding must come to textfield corressponding.
for example. There are two table A and B.
Table A has Colunm
S_ID number;
C_ID Varchar2 (30);
VARCHAR2 (4) s;
Second table B Colunm name
S_ID number;
What varchar (30);
L_Name varchar (20);
When I enter in a text field then the c_id 101 s_id, dry, first_name and last_name should come to corressponding text without refresh fields.
How can I do that.
Thank you
MauryYou can use Ajax and there are tons of good examples out there for this purpose;
For example [http://apex.oracle.com/pls/otn/f?p=31517:236:1876567353842241] -
Extract single line transformed from two tables
I have two tables T1 and T2 with the same set of columns. The columns are C1, C2, C3, COND1. I need to issue a query that returns a line transformed in order to respect the following rules:
1. the returned line may contain values from both tables based on the values of column in table T1.
2 return the column C1 in table T1; If it is NULL, then return to any value is present in the column C1 of T2.
3. article 2 above apply to all columns like C1, C2 etc.
I published the following query. The problem is that if a subquery does not reach the entire query fails. Someone help me please. Probably there is another simple method.
SELECT NVL (T1.c1, T2.c1) c1, c2 (T1.c2, T2.c2) NVL NVL (T1.c3, T2.c3) c3
FROM (SELECT c1, c2, c3
FROM T1
WHERE cond1 = 'T10') T1
(SELECT c1, c2, c3
THE T2
WHERE cond1 = "T200") T2;
Hello
user4274403 wrote:
I have two tables T1 and T2 with the same set of columns. The columns are C1, C2, C3, COND1. I need to issue a query that returns a line transformed in order to respect the following rules:
1. the returned line may contain values from both tables based on the values of column in table T1.
2 return the column C1 in table T1; If it is NULL, then return to any value is present in the column C1 of T2.
3. article 2 above apply to all columns like C1, C2 etc.
I published the following query. The problem is that if a subquery does not reach the entire query fails. Someone help me please. Probably there is another simple method.
SELECT NVL (T1.c1, T2.c1) c1, c2 (T1.c2, T2.c2) NVL NVL (T1.c3, T2.c3) c3
FROM (SELECT c1, c2, c3
FROM T1
WHERE cond1 = 'T10') T1
(SELECT c1, c2, c3
THE T2
WHERE cond1 = "T200") T2;
Are you saying that if there is no row in t1 that satisfy the condition cond1 = "T10", then you want to keep seeing the lines (and values) of the t2?
And even, if there is no row in t2 that satisfy the cond1 = "T200" condition, then you want to keep seeing the lines (and values) from t1?
If so, this looks like a job for a full outer join.
You can change the join in a full outer join as follows:
SELECT NVL (T1.c1, T2.c1) AS c1
, NVL (T1.c2, T2.c2) C2
NVL (T1.c3, T2.c3) AS c3
FROM T1
FULL OUTER JOIN T2 ON t1.cond1 = 'T10 '.
AND t2.cond1 = 'T200.
WHERE t1.cond1 = 'T10 '.
OR t2.cond1 = "T200"
;
If you would care to post CREATE TABLE and INSERT instructions for some examples of data, then I could test this.
What happens if no table has all the lines that have good values in cond1?
-
Find unmatched columns from two tables
Hello guys,.
I am trying to compare two tables based on a key of the indexed columns.
Here is an example of what I'm trying to achieve:
Table A: A_ID A_Name A_Income A_housecount
Jess 11 9 2
Rauny 4 6 22
Table b: B_ID B_Income B_housecount
11-5-2
22 6 4
In the example above data columns A_ID and B_Id are same in both tables. I'm trying to compare A_Income with B_Income & & A_housecount with B_housecount. The results of this series of samples would be:
11-9-2
11-5-2
as income in the same id is different.
As I have large amount of data in the two tables can you please give me some ideas on how I can get my results? Let me know if the explanation is not clear for you.
Thanks in advanceselect hshold_id,hsold_income,hshold_size, 'abc.' || case count(src1) when 0 then 'demo' else 'hshold' end the_source from (select hshold_id,hsold_income,hshold_size, 1 src1, to_number(null) src2 from abc.hshold union all select hshold_id,hsold_income,hshold_size, to_number(null) src1, 2 src2 from abc.demo ) group by hshold_id,hsold_income,hshold_size having count(src1) != count(src2)
Concerning
Etbin
Edited by: Etbin on 11.2.2011 18:00
correction of alignment -
Help in mandatory query - pulling data from two tables and inserting a
Hi all
I need your help for the modification of the query to get the desired result.
I have two tables A and b. using source Insert and select the command, I need to extract data from tables A and B, then insert and C.
Data and table structures are available below.
Table (Source Table)
Status of payment $
MUL DC 20
ONLY DC 20
ONLY 40 PA
MUL NY 50
Table B (Source Table)
State of lang units
E DC 10
S DC 10
NY E 5
PA S 5
Based on query, I need the values in table C as mentioned below.
Table C (Table of Destination) (necessary output query must also be as below)
The State value
PA 8
DC 1
My query is
INSERT INTO C(STATE,VALUE)
SELECT A.STATE, SUM ($) /SUM (UNITS)
OF A, B
WHERE PAYMENT = "SINGLE".
AND A.STATE = B.STATE
GROUP OF A.STATE, B.STATE
But the output I get is
PA 8
DC 2
Essentially to DC, I should get 1, i.e., for payment only $ DC is 20 and divided by 20 DC must be 1.
Let me know where I'm missing.Hello
It will work you need to add units in the group by clause
SELECT a.state, SUM (dollars) / units FROM a, (SELECT state, SUM (units) units FROM b GROUP BY state) sub WHERE payment = 'SINGLE' AND a.state = sub.state GROUP BY a.state, units;
Concerning
-
Hello, I have a problem writing to a specific SELECT statement and I hope you can help me.
I have two tables:
Customer:
-Integer ID (PK)
-Name_SecondName varchar (20)
-Char sex
-Full scale
Investments:
-Integer ID (PK)
-Whole amount
-Interest Numeric (3.2)
-Client_ID (FK)
My job is to display a number of men and a few women who have at least a $ 1000 investment. I'll jump to add data to the table, my point is simply to find a correct interpretation of the SQL query. Right now I have this:
SELECT COUNT (DISTINCT Client_ID), COUNT (DISTINCT Client_ID)
SOME customers JOIN investments
WE Clients.ID = Investments.Client_ID
WHERE amount > 1000;
Of course, it displays twice the number of clients thanks to an investment of more than $ 1000. But how do I specify that the first indictment counts men (sex = am') and second - women (sex = 'F')? Can someone help me?
Published by: 934019 2012-05-13 12:10Hello
Here's a way to do
SELECT COUNT (DISTINCT CASE WHEN c.gender = 'M' THEN c.client_id END) AS men , COUNT (DISTINCT CASE WHEN c.gender = 'F' THEN c.client_id END) AS women FROM clients c JOIN investments i ON c.client_id = i.client_id WHERE i.amount >= 1000 ;
This query will work in Oracle 8.1 or more.
Since you have Oracle 11, you can also use the SELECT... Function pivot, but in this case, it's more complicated. That's because what to CHOOSE... PIVOT includes automatically by each column that is not involved in the pivot. (In this case, this means that all except sex and client_id columns.) Often, you do sort of a subquery to get the dynamic no cross data, so it is easy to include only the relevant columns. In this case, however, you need not any kind of subquery, so you should add a fair to exclude the additional columns if you want to use SELECT... PIVOT.As you say in your original post, this account of customers who have any single investment of 1000 or more. In your last post, you posted a query that looks for investments of more than 15,000. You can change the WHERE clause to say
WHERE i.amount > 15000
but which would produce 0 men and 0 women, given that all of the amounts in the sample data are 10000.
934019 wrote:
Is it possible to display the entire word 'Genre' and not only "G"?Sure.
SQL * automatically sizes string columns to their maximum size. Since between the sexes are defined as CHAR (1), its maximum size is 1 character, then SQL * Plus allocates only 1 space for her, truncate the heading after 1 character. You can explicitly set the width on anything it is large enough to show the entire title, like this:
COLUMN gender FORMAT A6
Include this command before you run the query. Then, SQL * Plus uses 6 places to display the sex, so there will be place for all 6 characters in the heading.
-
How to migrate from two tables
Hello
I have three tables.
Issue table 1)
QID text
1. What is the capital of the India?
2 who is our PM?
(2) table answer
response to help qid
1 1 Chennai
2 1 Delhi
3 1 Bangulore
4 2 kamal Singh
5 2 Sonia
6 2 Manmohan Singh
(3) table c
question A B C qid
1. What is the capital of the India? Bangulore of Delhi from Chennai
2 who is our PM? Kamal Singh Sonia Manmohan Singh
Please tell me how to insert data from the first two tables in the third table by using a procedure?
I tried, I get answers in the columns...
Thank you
SAILook at this post.
(1) I used row_number to retrieve the columns, for which the data are intended
(2) I used the PIVOT to convert data into columns. -
Creating records from two Tables at the same time...
I would be very grateful if someone could help with the following query.
I have two Tables, Tbl1 and Tbl2. Tbl1 has the following columns: -.
Tbl1_Unique_ID, Description
Tbl1_Unique_ID is of type ' * number *' and ' * PK * ', Description is of type' * Varchar2 *'.
Tbl2 has the following columns: -.
Tbl2_Unique_ID, Description, Tbl1_Unique_ID
Tbl2_Unique_ID is of type ' * number *' and is the ' * PK * ', Description is of type' * Varchar2 *' and Tbl1_Unique_ID is of type ' * number *', is a ' * foreign key *' and is the ' * primary key *' from Tbl1.
While I can create a page to display and create folders in Tbl1, I'm not course coding required to view and create records Tbl1 and Tbl2 simultaneously, as well as regarding the two together at the same time.
I know that it involves one ' * INSERT *' statement, but I have problems the correct SQL query.
Can anyone provide any assistance will be appreciated.Have you tried to create a form master / detail page? Because it seems that is what you need...
-
Hello
My main table is:
create table CvProperties( cv_id number(14) primary key, user_id number(14) constraint Cv_fk1 references users(user_id), cat_id number(14) constraint Cv_fk2 references CvCategories(cat_id), employerOrAgent_id number(14) constraint Cv_fk3 references employerOrAgent(employerOrAgent_id), staff_id number(14) constraint Cv_fk4 references staff(staff_id), cvDate timestamp(0) default sysdate, cvName varchar2(230), status number(3), prev_cvId number(14), isEdited number(2), cvSource number(2) /**website, employer, agent, staff**/ );
Detail table is:
create table cvDetails( cd_id number(14) primary key, cv_id number(14) constraint education_fk references CvProperties(cv_id), nationality varchar2(230), objectives varchar2(3900), name varchar2(230), fatherName varchar2(230), motherName varchar2(230), dob varchar2(230). gender varchar2(230), mStatus varchar2(230), passportNo varchar2(110), email varchar2(230), phone varchar2(45), mobile varchar2(25), address varchar2(2500), state varchar2(230), zipCode varchar2(230), city varchar2(230), education clob, experience clob, skills clob, languages varchar2(1400), hobbies varchar2(3200), achievements varchar2(3900), references varchar2(3900));
I'm trying to delete the cvs that have no email + mobile + phone:
select COUNT(*) from cvDetails where email is NULL AND mobile IS NULL AND phone IS NULL;
This query shows 4814 CVs.
How can I run that check if the e-mail, phone mobile, is null then remove cv of the two tables in query?
Please notify
https://www.Google.com/webhp?hl=en&tab=WW#hl=en&q=Oracle+on+delete+cascade
-
Delete rows in a table when the columns from two tables match
Hello
I have following two tables.
===========================================
create the table empbooth as
(
Select 1 empid, 1 double cabin Union all the
Select option 2, Union 1 double all the
Select 3, Union 1 double all the
Select option 4, Union 2 double all the
Select option 5, 2 double
);
create the table attsht as
(
Select 1 empid, 240 reg, 0 unpaid all double union
Select option 2, reg 200, 0 unpaid of all the double union
Select 3, 240 reg, 0 unpaid all double them union
Select 4 480 reg, 0 unpaid all double union
Select 5 240 reg, unpaid double 0
);
=================================================
I want to remove rows from attsht where corresponding booth (which is stored in the empbooth table) is 1.
The condition is 'where attsht.empid = empbooth.empid and empbooth.booth = 1 '.
I use oracle 10g.
Help, please
delete from attsht where a.empid in (select b.empid from empbooth b where b.booth = 1)
or
remove from attsht a
where exists (select null
of empbooth b
where b.booth = 1
and b.empid = a.empid)
-
How to match columns from two tables with
Hello:
I have two tables as below:
Table1::(Base Table)
Country | Prefix | Prefix_Length
Travel | 001 | 3
CountryB. 0012 | 4
PaysC | 00443 | 5
CountryD | 0091 | 4
:(Detail Table) table2
The population | Area | Prefix
500 | AreaA | 0015921
1000 | AreaB | 00122
400. AreaC. 00443743
300. ALIS | 0091333
100. AreaA | 001
I need to match these two tables with prefix columns (whose length is not fixed in the two tables: but it starts with 00 in the two tables). Two different countries the prefix may be similar up to a certain length. Thus, Prefix_Length can be used to determine (exactly) how much time should be taken in the search of Table2.
Output:
Country | Prefix | Area | Population
Travel | 001 | AreaA | 600
CountryB. 0012 | AreaB | 1000
PaysC | 00443 | AreaC. 400
CountryD | 0091 | ALIS | 300
Please help me with your valuable comments.
-TenderTry this
with base_table as ( select 'CountryA' country,'001' prefix,3 prefix_length from dual union all select 'CountryB','0012',4 from dual union all select 'CountryC','00443',5 from dual union all select 'CountryD','0091',4 from dual ), detail_table as ( select 10 no_of_call,'0015921' prefix from dual union all select 3,'00122' from dual union all select 50,'00443743' from dual union all select 50,'00443643' from dual union all select 300,'0091333' from dual union all select 60,'001' from dual ) SELECT country, prefix,sum(no_of_call) FROM ( select country, b.prefix,no_of_call, decode(no_of_call,lead(no_of_call,1,0) over(partition by no_of_call order by b.prefix,no_of_call),'y','n') y_or_no from base_table b, detail_table d where b.prefix = substr(d.prefix,1,prefix_length)) where y_or_no !='y' group by country, prefix order by country, prefix;
Published by: Vi on 20 February 2012 01:07
-
help in registration of the records from two tables
HI: I have two tables joined the first field. The field is the primary key in the first table. Need help listing records from both tables with each a line/record results.
I want to print each record in the table of EVENTS such as a line and the corresponding records in EVENT_UPDATES as a line like this recordcreate table EVENTS ( event_key varchar2(64) primary key, event_description varchar2(64), create_time int ); create table EVENT_UPDATES ( event_key varchar2(64) NOT NULL , update_description varchar2(64), update_time int ); insert into EVENTS values('Event1', 'This is event1', 1); insert into EVENT_UPDATES values('Event1', 'Ticket created', 3); insert into EVENT_UPDATES values('Event1', 'Event cleared', 10); insert into EVENTS values('Event2', 'This is event2', 4); insert into EVENT_UPDATES values('Event2', 'Ticket created', 6); insert into EVENT_UPDATES values('Event2', 'Event cleared', 8);
TIAEvent1 1 This is event1 3 Ticket created 10 Event cleared Event2 4 This is event2 6 Ticket created 8 Event cleared
Raviselect case weight when 1 then event_key end key, time_val, description from ( select event_key, create_time time_val, event_description description, 1 weight from events union all select event_key, update_time, update_description, 2 weight from event_updates ) order by event_key, weight / KEY TIME_VAL DESCRIPTION ---------- ---------- ------------------------- Event1 1 This is event1 3 Ticket created 10 Event cleared Event2 4 This is event2 6 Ticket created 8 Event cleared 6 rows selected. SQL>
SY.
-
Several lines to a format of columns from two tables
Oracle Database 11 g Enterprise Edition Release 11.1.0.7.0 - 64 bit Production
The difficulty to return several lines simple lines/columns in two tables.
Table 1:
ID BOOK_NBR
1 1001
1 2001
2 1010
3 1020
Table 2:
AUTHOR BOOK_NBR
1001 JOHN_1
2001 JOHN_2
MARY 1010
1020 JUNE
Desired output:
ID BOOK_NBR AUTHOR BOOK_NBR AUTHOR
1 1001 JOHN_1 2001 JOHN_2
2 MARY 1010
3-1020 JUNE
There are an unknown number of BOOK_NBR to one ID.
Any guidance would be appreciated.
-
How to upgrade all the record for a particular column in a table based on search criteria.
Hi all
I'm new to ADF. I have a requirement where I have to perform the update of mass on a table.
Scenario:
Ex: I have a search region manual dept. where I search with deptId: 20. I get 20 records in my table. now I have another area where I have an inputchoice list that contains all the column names that exist in the dept table. Beside that, I have a text box and a button update
The user now, first research with dept id: 20 and click on the button Search, where it shows 20 record in the table. He then select an input choicelist(ex: ManagerId) column, then enter the new value in the decision-making box(ex: abc) then click on the button update.
Now, I want to, all the records in the ManagerId column with dept id: 20 update with the new value 'abc '.
Can someone help me with the code.
Thanks in advance...
Hello
If you go to your VO and generate the ViewObjectImpl, here you can create a method that contains two parameters, 1 the name attribute and 2 the value.
Then you can follow something as explained in this post:
ADF tutorial: how to apply actions in bulk to a view object lines
The only difference is that you must create a method like this:
' Public Sub updateAttribute (attribute String, Integer value) {}
RowSetIterator iter = createRowSetIterator (null);
While (iter.hasNext ()) {}
Line = iter.next ();
row.setAttribute (attribute, value);
}
}
Then execute you who expose a customer interface and then after you filter your table according to your criteria just this method passing the correct parameters.
Concerning
-
Select from different tables based on results
How to do this in a select
4 paintings
T3 and t4 are identical in structure, but different data
Select the id of the t1
If exist in select t2 id
Then select the data on t3
on the other
Select the data on t4
create table t1 (ID);
create table t2 (ID);
create table t3 (varchar2 (10) col1, col2 varchar2 (10));
create table t4 (varchar2 (10) col1, col2 varchar2 (10));
Insert into t1 values (1);
Insert into t1 values (2);
Insert into t2 values (1);
Insert into t3 values('DATA1','DATA2');
Insert into t4 values('DATA3','DATA4');
commit;
Ive had the values 1 and 2 in t1. ID = 1 exist in t2, for this record, I want I want the values of t3 but where id = 2, the t4 values.
Possible in a select? Ive been playing with case statement but not anywhere near him
Try this
Select *.
T3
where exists (select 1 from T1 t where t.id in (select t2.id T2))
----
Union of all the
----
Select *.
T4
where does not exist (select 1 from T1 t where t.id in (select t2.id T2))
-----
Ramin Hashimzade
Maybe you are looking for
-
Firefox has not detected antivirus
Whenever a download is complete, I get the following error "Antivirus Program" not found Although the microsoft security essentials is installed. I'm using Windows 7 Home Basic (64-bit edition).
-
Warranty and service for carbon models Thinkpad X 1 in India
Hello I intend to buy a Thinkpad X carbon 1 with US. If something happens to any part of this model, it will be replaced/repaired in India. I sent by mail in support of lenovo to the same questions, but I have big get no response. I called the servic
-
error code 800706BE for KB948465
In June 2009 I was invited by an automatic update on default update an 'important' Windows Vista Service Pack 2. It seems that there is an error 800706BE for this update faild. A few weeks later, there was an automatic update again for this SP2 but
-
Issue of notification led several
Hello I would like to ask if is it possible to alternate the color when you have several notifications. I noticed that when I get two different notifications with different colors of light just flickers with a single color. Thank you.
-
Z3 blackBerry Blackberry ID forgotten password
I forgot my password Blackberry ID. I put your hint question. But whenever I answer the question, it is to say that the answer is incorrect. What should do?