Display two tables 1 d on Wavechart
Hello
How to display two tables 1 d of the same size on a WaveChart
Thank you.
No, aid is correct, if wire you a table 2D to waveform curve, you can transpose it in the context menu as follows:
Checking / unchecking this option has the same effect than to put a 2D conversion table before you wire your table in the waveform table.
Tags: NI Software
Similar Questions
-
I have two table display and it works very well, but I want to display the data as all first it display data from a table in ascending order, then
It show data from the second table in the order of asceding
create or replace view wg_team
as
Select emp_name form wgteam
Union
Select the name of the component in component_master;create or replace view wg_team
as
Select emp_name, 1 test for form wgteam
Union
Select the name of the component, 2 test of component_master
order of test; -
Summary
two tables:
Table 1 categories
Table 2A categories that someone has selected
HTML form that updates the user's data:
form should show all the options in the category dynamically in table 1
and also to display the check box of the category as controlled dynamically if the person chose by table 2
The nuts and bolts
Attempt 1
My sql:
SELECT cat.id, cat.category, mcat.category as mcategory
THE CAT of categories, members_categories mcat
WHERE mcat.member_id = ' "." $_GET ['id']. »"
ORDER BY category ASC
(run on its own, all categories of table 1 are shown twice and the results of table 2 is a total cluster.)
area of the form with checkboxes:
<? PHP {? >}
< input <? PHP if (!) ((strcmp($row_rsCategories['mcategory'],$row_rsCategories['id'])))) {echo ' checked =------'checked\' ' ;}?} > name = "category []" type = "checkbox" value = "<?" PHP echo $row_rsCategories ['id'];? ">" / > <? PHP echo $row_rsCategories ['category'];? > < br / >
<? PHP} while ($row_rsCategories = mysql_fetch_assoc ($rsCategories));? >
what I have here results:
all categories displayed twice with selected categories of table 2 verified = by the results of sql when running alone
Attempt 2
My sql:
SELECT cat.id, cat.category, mcat.category as mcategory
CAT categories
LEFT JOIN members_categories mcat WE mcat.category = cat.id
WHERE mcat.member_id = ' "." $_GET ['id']. »"
ORDER BY category ASC
(run on its own, all categories of table 1 who have a match in the table 2 and none of the other in table 1 shows)
area of the form with checkboxes:
even the first attempt
what I have here results:
all categories selected in table 2 shows and checked, and no other choices of table 1 = by the results of sql when running alone
Attempt 3
My sql:
SELECT cat.id, cat.category, mcat.category as mcategory
THE CAT of categories, members_categories mcat
WHERE mcat.member_id = ' "." $_GET ['id']. »"
GROUP BY cat.id
ORDER BY category ASC
(running his own, all the choices in the category of table 1 are displayed, however, the mcategory column displays the lowest category numbered (same one) against all of these options rather then correspond to their.)
area of the form with checkboxes:
even the first attempt
what I have here results:
all choice of category in table 1 are displayed, however, only the first category in table 2 (which in this case is the lowest number) is marked as checked with the checkboxe, even if there is more then one category in table 2 = by the results of sql when running alone
so, can anyone help? I'm just banging my head against the wall here is something missing that should be obvious, because the sql is not giving me what I need to work with the form in a loop region. Perhaps another approach should be taken and I have change the loop as well, but I think that this can be resolved with the sql. Thanks in advance.
Well, you can use two separate sql queries...
one with the names of the categories
and the second nested with the loop that references the id of category in table 1 to pair with table 2
-
display the data in two tables.
Hi considers the following data
I want to join these two tables and result the followingWITH table1 AS ( SELECT 111 userid, To_Date('7/31/2010','mm/dd/yyyy') dt FROM dual UNION ALL SELECT 111 userid, To_Date('8/1/2010','mm/dd/yyyy') dt FROM dual UNION all SELECT 111 userid, To_Date('8/2/2010','mm/dd/yyyy') dt FROM dual UNION ALL SELECT 111 userid, To_Date('8/3/2010','mm/dd/yyyy') dt FROM dual UNION ALL SELECT 111 userid, To_Date('8/4/2010','mm/dd/yyyy') dt FROM dual UNION ALL SELECT 111 userid, To_Date('8/5/2010','mm/dd/yyyy') dt FROM dual UNION ALL SELECT 222 userid, To_Date('2/28/2010','mm/dd/yyyy') dt FROM dual UNION all SELECT 222 userid, To_Date('3/5/2010','mm/dd/yyyy') dt FROM dual UNION all ), mydates AS ( SELECT To_Date('7/31/2010','mm/dd/yyyy') dt1, To_Date('8/4/2010','mm/dd/yyyy') dt2 FROM dual UNION ALL SELECT To_Date('2/28/2010','mm/dd/yyyy') dt1, To_Date('3/5/2010','mm/dd/yyyy') dt2 FROM dual )
Basically, I join two tables, take dt from table1 and look into mydates. If the data match then display dt and DM2.DT DT2 7/31/2010 8/04/2010 8/01/2010 8/01/2010 8/02/2010 8/02/2010 8/03/2010 8/03/2010 8/04/2010 8/04/2010 8/05/2010 8/05/2010 2/28/2010 3/5/2010 3/5/2010 3/5/2010
If the date in table1 does not match date in t1d in mydates, then display the data but dt and DM2 there same date.
for example,.
7/31 in table1 is 7/31 in mydates so I show 7/31 dt and DM2 as 8/4(from mydates).
now 8/01 does not match all lines in my dates so dt should be 8/01 and T2D should be 8/01. same logic applies to the other lines
can someone write a query that gives the above result? Thank youHello
If you want all lines of table1 (attached to mydates when this is possible, but even when there is no match) then use an outer join:
SELECT t.dt , NVL (m.dt2, t.dt) AS dt2 FROM table1 t LEFT OUTER JOIN mydates m ON t.dt = m.dt1 ORDER BY t.dt ;
-
Display data from two tables based on date criteria
Hi all
I 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_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.LOGON_ID USER_ID LOGON_TIME LOGON_TYPE SUBSCRIBER_NO CUSTOMER_ID 26063548 4528890298 4/5/2010 12:03:58 AM MSISDN GSM04528890298 581751708
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. -
getting data between two tables
Hi everyone, I need help with a query that seems simple, but I can't understand. consider the following data.
with data as (
s élire 802 cd from dual union all
select 803 cd from dual union all
select 804 cd from dual
data2 as
( select 804 cd from dual )
I want to join the two tables so that the result will be as follows:
in the above data, we can see that 804 is common in both tables. in this case, the output should be 804.
Similarly, if 2 data include the following:
data2 as
( select 804 cd from dual union all
Select 803 cd from dual
)
the output is then 803 804.
Now consider the following data
with data as (
s élire 802 cd from dual union all
select 803 cd from dual union all
select 804 cd from dual
)
take data2 table is empty
I want to join the two tables, and in this case, the output should be 802,803,804. data2 table is empty, then the default behavior is to get all the data in the data table. Since there is no line that corresponds to rows in the data table,
the default behavior is to display output all data in the data table. in this case 802,803,804
can someone write a query for this?
Hello
elmasduro wrote:
Hi Frank, thanks for the request. These are very good questions. Here are the answers
What happens if data2 rows, but none of them match data CD?
It won't happen because the integrity of the data.
...
I see it; a data line 2 will be in the data. You have a FOREIGN KEY constraint, or something similar, so if cd = 804 exists in database2, then it must also exist in the data.
What happens if the data is empty and data2 is not?
If data is empty and data2 is not, then the data2 data should be released.
for example
with the data as)
data table is empty
data2 as
(select cd 804 Union double all the)
Select cd 805 double
)
When you join data and data2 account with the above data, then the output should be 804 805. data2 data should be the display if the data table is empty. ...
Doesn't that contradict what you said earlier? Previously, it seemed to say that each row of data2 will be in the data, but now you give an example where all data2 lines are not in the data.
If the first is true, then the solution in response #2 should work.
If the latter is true, you can change the query like this:
WITH got_r_num AS
(
SELECT NVL (d.cd, d2.cd) AS cd
DENSE_RANK () (ORDER IN CASE
WHEN d.cd IS NOT NULL
AND d2.cd IS NOT NULL
THEN "A".
WHEN d.cd IS NOT NULL
THEN 'B '.
ANOTHER 'C '.
END
) AS r_num
DATA d
FULL OUTER JOIN data2 d2 ON d.cd = d2.cd
)
SELECT cd
OF got_r_num
WHERE r_num = 1
ORDER BY cd
;
-
How to join two tables if you transpose the rows, columns and rows in one of the table
Hi guys,.
can someone help me please in the write request
I have two tables
Agents and Agent phones but in the agent phones table for the id of an agent it displays 4 rows because one of the column there types of different phones (office, mobile, home, fax)
So instead of display 4 rows, I used max(case...) to convert rows to columns
now how to reach it with another table
Requirement:
Database: 11.2.0.2.0
create the table AGENT_PHONE
(
agent_id NUMBER (20) not null,
agent_type_code VARCHAR2 (10) not null,
agent_type_prefix VARCHAR2 (10) not null,
Phone_Number VARCHAR2 (16) not null,
phone_type_code VARCHAR2 (10) not null
)
CREATE TABLEAGENTS
(
agent_id NUMBER (20) not null,
agent_type_code VARCHAR2 (10) not null,
agent_type_prefix VARCHAR2 (10) not null,
NAME VARCHAR2 (40) NOT NULL
)
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '4805551436', 'CELL');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '1111111111', 'PHONE');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '2223334444',' OFF');
INSERT INTO AGENT_PHONE(AGENT_ID,AGENT_TYPE_CODE,AGENT_TYPE_PREFIX,PHONE_NUMBER,PHONE_TYPE_CODE)
VALUES (29709, ARE ', 'OFFICE', '5556667788', 'FAX');
INSERT INTO VALUES AGENTS
(29709, ARE ', 'OFFICE', 'FLY');
INSERT INTO VALUES AGENTS
(1234, ARE ', 'OFFICE', 'MIKE');
SELECT * FROM AGENT_PHONES
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX PHONE_NUMBER PHONE_TYPE_CODE ---------------------------------------------------------------------------------------------
29709 RE OFFICE 4805551436 CELL 29709 RE OFFICE 1111111111 PHONE 29709 RE OFFICE 2223334444 OFF 29709 RE OFFICE 5556667788 FAX
SELECT * AGENTS
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME
29709 RE OFFICE ROB 1234 RE OFFICE MIKE
This is so the data we have in both table
Now, I transposed rows to columns in the table of agent phones so I used the following query
SELECT AP. AGENT_ID,. AGENT_TYPE_CODE,. AGENT_TYPE_PREFIX.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'CELL' THEN AP. PHONE_NUMBER END) AS CELL.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'OFF' THEN AP PHONE_NUMBER END) AS TURNED OFF.
MAX (CASE WHEN AP. PHONE_TYPE_CODE = 'FAX' THEN AP. PHONE_NUMBER END) LIKE FAX,.
MAX (CASE WHEN PHONE_TYPE_CODE = 'PHONE'. THEN AP PHONE_NUMBER END) AS PHONE
AGENT_PHONE AP
WHERE AP. AGENT_ID = 29709
GROUP OF AP. AGENT_ID, AP. AGENT_TYPE_CODE, AP. AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL OFF FAX PHONE 1 29709 RE OFFICE 4805551436 2223334444 5556667788 1111111111 My question is how this to join the agents table so that my output should be like this...
I want to display all the results in the table of the Agent, even if they are not in the table of agent phones. As you can see there are other agent id 1234 is also populated
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 1234 RE OFFICE MIKE Currently, I run this query and I get the output as below
SELECT *.
AGENTS HAS
LEFT OUTER JOIN AGENT_PHONE AP
ON A.AGENT_ID = AP. AGENT_ID
AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.
AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX PHONE_NUMBER PHONE_TYPE_CODE 1 29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 CELL 2 29709 RE OFFICE ROB 29709 RE OFFICE 1111111111 PHONE 3 29709 RE OFFICE ROB 29709 RE OFFICE 2223334444 OFF 4 29709 RE OFFICE ROB 29709 RE OFFICE 5556667788 FAX 5 1234 RE OFFICE MIKE I want id 29709 agent in a line with 1234 agent also id to display
You can rotate your phone number of agent in columns
Select *.
of AGENT_PHONE
pivot)
min (PHONE_NUMBER)
for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')
)
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 Then you can join to view inline or CTE
with AGENT_PHONE_PIVOT like)
Select *.
of AGENT_PHONE
pivot)
min (PHONE_NUMBER)
for PHONE_TYPE_CODE in ('CELL' as a 'CELL', 'PHONE' like 'PHONE', 'OFF' in the 'OFF', 'FAX' as 'FAX')
)
)
SELECT *.
AGENTS HAS
LEFT OUTER JOIN AGENT_PHONE_PIVOT AP
ON A.AGENT_ID = AP. AGENT_ID
AND A.AGENT_TYPE_CODE = AGENT_TYPE_CODE.
AND A.AGENT_TYPE_PREFIX = AGENT_TYPE_PREFIX.
AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX NAME AGENT_ID AGENT_TYPE_CODE AGENT_TYPE_PREFIX CELL PHONE OFF FAX 29709 RE OFFICE ROB 29709 RE OFFICE 4805551436 1111111111 2223334444 5556667788 1234 RE OFFICE MIKE - - - - - - - Is that what you're looking for?
-
Aliging two tables side by side on a classic report
Hello
I have three regions on my page. The first two regions are of pie charts and appear side by side.
The third area is a classic report and appears in graphic regions.
The problem is that the first chart area has the same width as the region of the classic report. This causes a gap between the two tables. How can I remove the gap between the two graphic region, ignoring all that is the width of the classic report?The page below shows an example:
https://Apex.Oracle.com/pls/Apex/f?p=76322:22
Username: forum
Password: abc123
Thank you
Zkay
ZKay wrote:
Thanks for the reply. It reminded me of the importance of mentioning the version etc.
I use 11g with Apex 4.0. and the generator 101 Blue theme.
So, please advise to what precedes.
APEX 4.0, according to me, you will need to assign property attributes of the region HTML table cells of the region report
colspan="2"
or put the report on a different display area point tables, say body Page Template (1 points below the content of the region) for maps and body Page Template (2 items below the content of the region) for the report. -
How to link two tables with form
Hello
Here's what I want to do
I have a table-> Student (rollno, name)
I also have these two tables (rollno, marks) Math Physics (rollno, marks)
now, I want to have a form in my page (in which I can navigate school records) and two tables in the adf (Math, physical). When selecting a certain record of the form, I want to see data associated with these two tables.
I try to make the link display but works for me...
Please help me on this.
-Usman
-Open the module of the application
-Go to the model data tab
-You will see all the your available on the left and your already added to the AM to the right
-For the your who are 'master' for others your (in your case, student VO's master VO of Math and physics VO), you will see a (+) monkey behind it
-Expand this node and you will see the math and physics your.
-Math VO on the left and the VO student on the right then click on the button (>) to shuttle Math VO VO of the student child and give it a name
-Repeat step for physics VO
After completing the above steps and save, go back to your jsf (or jspx or...) and in the data tab control you will see this student VO is now two children, Math and physics. Use WHAT YOUR theses to create your tables for details.
Kind regards.
-
How to display two dept details at the same time in the form of master-detail
Hi Experts
In Forms 6I, using the Scott schema, table DEPT & EMP has created a simple form of master-details relationships.
Currently when user Dept Block shows all lines dept and EMP block display data based on the selection of deptno.
It's only a deptno both.
If the user in the No. 10, block EMP Dept will display all the data related to 10
If the user moves to 20 Deptno, block EMP will display all the data related to 20.
And so on.
But our requirement, what happens if we want to see the 10 and 20 at once (both several deptno)
Thank you
Thanks for your information.
In fact, our requirement is only to display data, he own be no matter what update of data/insertion.
So below and working for our requirement
- Remove relationship
- Additional box on master block.
- Write code cursor on the box selection - which will fill/clear data block information based on the checkbox selection on block Master.
-
Compare two tables, APEX
Hello
I am trying to compare two tables, but I want to display values that are the differnet from one to the other,
both tables have the same columns and have the same PK.
Thank you.Hello
You probably need a report based on a query like this:
SELECT d1.deptno, d1.dname, d2.dname, d1.loc, d2.loc FROM dept1 d1 INNER JOIN dept2 d2 ON d1.deptno = d2.deptno AND ( d1.dname <> d2.dname OR d1.loc <> d2.loc )
You can also consider using FULL JOIN where you have different values of primary key in both tables and you want to include in the report.
-
Main table with two tables of children as part of the ADF
Hello
I'm trying to implement single master with two tables in detail using oracle adf framework of Jdev 11.1.1.4.0. I am able to only master / details using the link display but unable to reach the details i.e., nested block child master with nested blocks.
I created query view object based on the master and two poll objects of the base seen as details. Then, I created two master of first child link and another link for master of the second child. Even in this case in my data controls I see two different components which is incorrect.
Please let me know how to create a data control for an example below:
Fruit [MASTER]
-Details of Fruits such as the table of the adf
-Apples [FIRST CHILD]
-Details of the apples as adf table
-Orange [SECOND CHILD]
-Details of the Oranges as adf table
Kind regards
Amar.You need two viewLinks
Fruit-> apples
Fruit-> OrangesThen, in the data model, you choose the entry of fruit that has:
Fruit
|---> ApplesYou stand on the fruit and you shuttle Oranges to be below left to right.
If you use the HR schema by default, you will see this type of relationship for employees:
https://blogs.Oracle.com/Shay/entry/master_with_two_details_on_the -
How to join two tables without constraints?
I want to get back the tables to join without constraints!
Table 1:
get 100
101 wet
series 102
and
Table 2:
10 xxx movies
11 yyy
12 zzz
QUERY 1:
SELECT * FROM TO LEAVE P, CUSTES C
WHERE (P.ID, P.NAME, C.ID, C.NAME) IN (SELECT P1.ID, P1.NAME, C1.ID, C1.NAME
OF P1, C1 CUSTES TO GO)
I got the result like this,
ID ID NAME
101 wet 10 xxx
zzz 101 wet 12
YYY 101 wet 11
Get 100 10 xxx
102 the yyy 11 value
series 102 10 xxx
100 get 11 yyy
100 get 12 zzz
102 the value 12 zzz
All ranks was sent three times! but I need to write once.
QUERY 2:
Select id as pid, name as the name of go
Union
Select id as pid, name as the name of custes;
QUERY2 OUTPUT IS.
NAME OF PID
10 xxx movies
11 yyy
12 zzz
get 100
101 wet
series 102
In the 2nd query get the attached files of the two tables. But my need is two tables record to display like this
ID NAME NAME_1 ID_1
Get 10 xxx 100
wet 11 101 yyy
set of 12 zzz 102
I'm looking for is, I want to join in parallel columns in my trips!
Is there a source... ? or the same code is happy...!Something like that?
WITH t1 AS (SELECT '100' id, 'get' name FROM DUAL UNION SELECT '101', 'wet' FROM DUAL UNION SELECT '102', 'set' FROM DUAL), t2 AS (SELECT '10' id, 'xxx' name FROM DUAL UNION SELECT '11', 'yyy' FROM DUAL UNION SELECT '12', 'zzz' FROM DUAL) SELECT id, name, (SELECT id FROM (SELECT ID, name, ROWNUM rw FROM t2) t_in WHERE t_in.rw = t_out.rw) id_1, (SELECT name FROM (SELECT ID, name, ROWNUM rw FROM t2) t_in WHERE t_in.rw = t_out.rw) name_1 FROM (SELECT ID, name, ROWNUM rw FROM t1) t_out
SQL> WITH t1 AS (SELECT '100' id, 'get' name FROM DUAL 2 UNION 3 SELECT '101', 'wet' FROM DUAL 4 UNION 5 SELECT '102', 'set' FROM DUAL), 6 t2 AS (SELECT '10' id, 'xxx' name FROM DUAL 7 UNION 8 SELECT '11', 'yyy' FROM DUAL 9 UNION 10 SELECT '12', 'zzz' FROM DUAL) 11 SELECT id, 12 name, 13 (SELECT id 14 FROM (SELECT ID, name, ROWNUM rw FROM t2) t_in 15 WHERE t_in.rw = t_out.rw) 16 id_1, 17 (SELECT name 18 FROM (SELECT ID, name, ROWNUM rw FROM t2) t_in 19 WHERE t_in.rw = t_out.rw) 20 name_1 21 FROM (SELECT ID, name, ROWNUM rw FROM t1) t_out; ID NAME ID_1 NAME_1 --- --- -- --- 100 get 10 xxx 101 wet 11 yyy 102 set 12 zzz SQL>
The number of rows in the tables are the same?
-
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.
-
problem with join of two tables
Hi, consider the following data
what I want to do, is to join data2 with data by isi, ri or southern id table and produce this output.WITH data AS ( SELECT 123 cid, 'aaa' isi, 'kkk' sud, 'ttt' ri FROM dual UNION ALL SELECT 222 cid, 'bbb' isi, 'gggg' sud, 'hhh' ri FROM dual ) , data2 AS ( SELECT 'aaa' isi, 'yyy' sud, 'ooo' ri FROM dual UNION ALL SELECT 'qqq' isi, 'ggg' sud, 'ooo' ri FROM dual UNION ALL SELECT 'uuu' isi, 'ppp' sud, 'ttt' ri FROM dual UNION ALL SELECT 'ppp' isi, 'mmm' sud, 'nnn' ri FROM dual )
It's how I got the above output:cid txt === ==== 123 aaa 222 ggg 123 ttt
first try to join isi in database2 with isi in "features" and discover if line matches. If this is the case, display the cid of the data table and the use of the value to match.
e.g. in the first line of table data2, we can see that isi = aaa matches line an isi data table. If the output displays 123 and value aaa.
If the rank table two of the Data2 isi = qqq. When join them with the data table, we find not all isi with qqq. in this case, it must join with column of South. We can see that South = ggg data2 games
the second line in the table of output so will bee 222 and value ggg.
now, take a look at the third row in Database2. ISI = uuu is not found in the data table when join them. then try to join to the South. South = ttt is also not found in any row of the data table. so join with ri. We
can see that ri = ttt data2 matches with ri = ttt in the table of data online 1. Therefore, we display the value.
can someone help me write a sql query that joins these two tables by isi. If no line found then join South, if no found rows then join in ri? Thank youHello
elmasduro wrote:
Hi Frank, data2.sud = 'Gay' (4 characters) assume to be South = "ggg". by mistake, I type extra g.I have another question about the request. What happens if I want to bring rows of data.2 even if they do not exist in the data table for the entire column was join?
for example, I want to show this:cid txt === ==== 123 aaa 222 ggg 123 ttt ppp --row from data2
the columns of the last row of data.2 does not match any column in the data table. in this case, I want to make but cid will be null. I tried outer join on your request, but it looks like I can not clause or with outer join
SELECT d1.cid , CASE WHEN d1.isi = d2.isi THEN d2.isi WHEN d1.sud = d2.sud THEN d2.sud ELSE d2.ri END AS txt FROM data d1 JOIN data2 d2 ON d1.is(+)i = d2.isi OR d1.sud(+) = d2.sud OR d1.ri(+) = d2.ri ;
How can I re - write the query for this case? Thanks again for your help
Here is the outer join syntax:
SELECT d1.cid , CASE WHEN d1.isi = d2.isi THEN d2.isi WHEN d1.sud = d2.sud THEN d2.sud WHEN d1.ri = d2.ri THEN d2.ri ELSE d2.isi END AS txt FROM data2 d2 LEFT OUTER JOIN data d1 ON d1.isi = d2.isi OR d1.sud = d2.sud OR d1.ri = d2.ri ;
The + sign for outer joins only works with the old join syntax, non-ANSI. Do not try to mix the two different ways to do joins.
Not to mention that the outer join, don't forget to change the CASE expression, to include the new possibility of any columns 3 join matching.
Maybe you are looking for
-
My daughter has an iPhone 5 c she's had for about two years and it has worked very well. She has updated to iOS 10 and mobile data has not worked since. I had a Verizon technical support check the account, and two different Verizon stores have change
-
HP - Photosmart printer 5520: photosmart 5520 -.
When the page prints all colors are OK except that 'Black' does not print. Cartridges are new.
-
VIDEO CHAT IN MESSENGER since my last ACCIDENT MY MISSING!
WHY DON'T I SEE THE PLACE FOR VIDEO CHAT IN MY WINDOWS LIVE MESSENGER?
-
RE Blu - ray discs. How many times can I burn?
Hi, I recently bought a blu - ray burner and a couple of BD - RE discs, I was wondering how many times I can burn and erase then burn again then delete again (you get the point)? I ask this because Iv read you can do upwards then 1000 times on other
-
Order of connection multiple Windows Live e-mail accounts
I use Windows Live mail on Windows 7 computer. I have two accounts installed. He who tries to access his mail server first is unreliable from time to time and when it cannot connect to the server I can't to the second account. Is it possible that I c