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
Tags: Database
Similar Questions
-
To create an interactive report in the apex by selecting from multiple tables
Hi, I am creating an interactive report by selecting from multiple tables.
SELECT w.FIRST_NAME as name, w.SURNAME as name, i.ROAD Road, i.DATE_OF_INC as DATE_OF_INC, S.STATEMENT as a STATEMENT OF Declaration
JOIN THE
WITNESS w
ON w.witness_id = s.FK1_WITNESS_ID
JOIN THE
Incident I have
WE
i.incident_no = w.FK1_INCIDENT_NO
JOIN THE
user_station ps
ON ps.station_id = i.nearest_station_id
JOIN THE
the user in.
WE
in. STATION_ID = ps.station_id
WHERE po.officer_id = 1
by I continue to encounter this error "the report query requires a unique key to identify each row. The supplied key cannot be used for this query. Please change the report attributes to define a unique key column. "ORA-01445: cannot select ROWID from where sample, a join without key preserved table view '
So I googled around and found that in the attibutres tables report, I need to change the "LINK" COLUMN so first, I changed "Link to custom target", but the report is so I changed it to "Exclude link Clolumn" again, the report didn't report and I STILL got a blank page with only the tabs.
I wonder you can not create a report by selecting from multiple tables?
If you can please I need your help.
Thank you
You can, but in this case, it might be easier to build your report tables that are joined Oracle views and then build your report out of the newly built sight...
Or wrap a selection around your selection with joins, and then make the where clause on the external selection...
Thank you
Tony Miller
Software LuvMuffin
Ruckersville, WILL -
Select from another table, when the query returns no result
Hello
I have a question where I'm supposed to retrieve the address of an account id-based billing. However, the table of billing may not have an address. There is a table of addresses that always has an address for an account. If the billing address exists, it should be used, so I can't use the address table. Is it possible in a select statement to query to the billing address and if it does not exist, use the address table.
SELECT * FROM accounts a, b billings WHERE a.accountid = b.accountid
Any help will be greatly appreciated.
Thank you.user10407139 wrote:
HelloI have a question where I'm supposed to retrieve the address of an account id-based billing. However, the table of billing may not have an address. There is a table of addresses that always has an address for an account. If the billing address exists, it should be used, so I can't use the address table. Is it possible in a select statement to query to the billing address and if it does not exist, use the address table.
SELECT * FROM accounts a, b billings WHERE a.accountid = b.accountid
Any help will be greatly appreciated.
I think you need to explain more clearly if
-you only have a couple of "billing" columns which is empty and in this case, you want to use the columns from the table 'accounts '.
- or you have a join with another table that doesn't return data, for example a foreign key "address_id" "billing" is zero and therefore the join to other tables 'address' will return all the data
In the first case, you have already been provided with some examples here, how to use NVL or similar functions to achieve, even if the first post first evaluates the information of 'accounts' and if it is white using information from "billing". According to your description you need the other way around. The second post a subquery recursive useless in my opinion.
In the latter case, you should probably use an "outer" join so that the data in your table "bills" are returned, even if the join to another table is not at all the lines.
SELECT NVL(AD1.ADDRESS_ATTR1, AD2.ADDRESS_ATTR1) as ADDRESS_ATTR1, NVL(AD1.ADDRESS_ATTR2, AD2.ADDRESS_ATTR2) as ADDRESS_ATTR2, NVL(AD1.ADDRESS_STREET, AD2.ADDRESS_STREET) as ADDRESS_STREET, ... FROM accounts a INNER JOIN billings b ON a.accountid = b.accountid LEFT OUTER JOIN address ad1 ON b.address_id = ad1.address_id INNER JOIN address ad2 ON a.address_id = ad2.address_id;
In this way you pick up the address stored in the "invoices" table, if it existed, otherwise you pick up the address assigned to the "accounts" table I used an inner for the second address join join because you said that the account always has an assigned address.
Kind regards
RandolfOracle related blog stuff:
http://Oracle-Randolf.blogspot.com/SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676 /.
http://sourceforge.NET/projects/SQLT-pp/ -
Having trouble selecting from a table function
Need a function to return an array in the following format:
The following error after the selection of a function that returns the table:WEEK_NBR START_DATE END_DATE ---------------------- ---------- --------- 0 29-JAN-09 25-NOV-09 1 26-NOV-09 02-DEC-09 2 03-DEC-09 09-DEC-09 3 10-DEC-09 16-DEC-09 6 26-NOV-09 16-DEC-09 7 29-JAN-09 16-DEC-09
Error from the 1 in the command line:select * from table(get_cwsr_ranges)
Select * from table (get_cwsr_ranges)
Error report:
SQL error: ORA-06504: PL/SQL: return variables of the game results or the query types do not match
ORA-06512: at "GET_CWSR_RANGES", line 23
06504 00000 - "PL/SQL: return of the variable result set or query types do not match.
* Cause: Numbers or types of columns in a query is not declared
return type of a variable result is defined or declared two result types
Set of variables do not match.
* Action: Change the program or the declaration statement. Verify that the query variable
actually we want during execution.
>
DDL:
Any suggestions?CREATE TYPE typ_date_range AS OBJECT (week_nbr number, start_date date, end_date date ); / CREATE TYPE typ_tbl_date_ranges AS TABLE OF typ_date_range; / CREATE OR REPLACE FUNCTION get_cwsr_ranges() RETURN typ_tbl_date_ranges PIPELINED IS v_dates_table typ_tbl_date_ranges; p_cursor sys_refcursor; rec typ_date_range := typ_date_range(NULL,NULL,NULL); BEGIN open p_cursor for with sample_data as ( select 0 as week_nbr , '29-JAN-09' as start_date , '25-NOV-09' as end_date from dual union all select 1 as week_nbr , '26-NOV-09' as start_date , '02-DEC-09' as end_date from dual union all select 2 as week_nbr , '03-DEC-09' as start_date , '09-DEC-09' as end_date from dual union all select 3 as week_nbr , '10-DEC-09' as start_date , '16-DEC-09' as end_date from dual union all select 6 as week_nbr , '26-NOV-09' as start_date , '16-DEC-09' as end_date from dual union all select 7 as week_nbr , '29-JAN-09' as start_date , '16-DEC-09' as end_date from dual ) select * from sample_data; LOOP FETCH p_cursor INTO rec; EXIT WHEN p_cursor%NOTFOUND; PIPE ROW(Rec); END LOOP; CLOSE p_cursor; RETURN; END get_CWSR_Ranges;
create or replace FUNCTION get_cwsr_ranges RETURN typ_tbl_date_ranges PIPELINED IS BEGIN for rec in ( with sample_data as ( select 0 as week_nbr , to_date('29-JAN-09', 'dd-mon-yy') as start_date , to_date('25-NOV-09', 'dd-mon-yy') as end_date from dual union all select 1 as week_nbr , to_date('26-NOV-09', 'dd-mon-yy') as start_date , to_date('02-DEC-09', 'dd-mon-yy') as end_date from dual union all select 2 as week_nbr , to_date('03-DEC-09', 'dd-mon-yy') as start_date , to_date('09-DEC-09', 'dd-mon-yy') as end_date from dual union all select 3 as week_nbr , to_date('10-DEC-09', 'dd-mon-yy') as start_date , to_date('16-DEC-09', 'dd-mon-yy') as end_date from dual union all select 6 as week_nbr , to_date('26-NOV-09', 'dd-mon-yy') as start_date , to_date('16-DEC-09', 'dd-mon-yy') as end_date from dual union all select 7 as week_nbr , to_date('29-JAN-09', 'dd-mon-yy') as start_date , to_date('16-DEC-09', 'dd-mon-yy') as end_date from dual ) select typ_date_range(week_nbr, start_date, end_date) the_type from sample_data ) loop pipe row (rec.the_type); end loop; END get_CWSR_Ranges;
and then...
select * from table(cast(get_cwsr_ranges as typ_tbl_date_ranges))
Published by: Tubby on December 26, 2009 19:05
Remove the implicit conversion using explicit TO_DATE... you should always do :)
-
How to load data from different tables, but record to another table?
Hi all
I use the apex and I understand how it updates and saves the files normally.
In this case, I would need to load from a table, but save on another Board on the button "submit".
I am aware that it would be easy as forms where I could do a manual insert process. im making in tabular form and I don't really know how to handle this process.
Suppose that I am loading a set of questionnaires in the form of tables and have a yes / no selection.
If the questions would come from table A and I need to save it in table B.
in this case that I can't put just the value default by the tabular row for questions coz it would be dynamic and this example is on a small scale. I would need to load the table A and record in table B.
could someone guide me on this operation or provide tutorials any?
Maybe that's what you're after.
(1) create region report using SQL like this:
Select apex_item.hidden(1,rownum).
apex_item.display_and_save(2,question_column) in Question,
apex_item. Text(3,,4,4) as answer
from table_a
apex_item documentation of package found:
http://docs.Oracle.com/CD/E37097_01/doc/doc.42/e35127/apex_item.htm
The pidx (first number) in each apex_item parameter is used to identify this item in the same row of the report' / tabular form.
(2) create a submit in procedure a bit like that.
Start
because I 1.apex_application.g_f01.count loop - identifies the "apex_item.hidden(1,rownum)" at the top and gets a count of how many times it occurs
Insert into table_b (question, answer)
values (apex_application.g_f02 (i), apex_application.g_f03 (i));
end loop;
end;
-
Select from the table where the last character of the string is numeric
Hello
I have a table of STREETS with a field called ADDRESS. I want to select all the records in streets where the last character in the address is a number.
Select ADDRESS of STREETS where regexp_like (substr (address,?,?,), '[0-9]');
--? means that I don't know what to put here!
I don't know if substr is the best approach to do this, because I want only the last character and the records are of different lengths.
Thank you!Hello
If you want to use regular expressions:
WHERE REGEXP_LIKE ( address , '[0-9]$' )
You can get the same results, no doubt more effectively, without regular expressions:
WHERE INSTR ( '0123456789' , SUBSTR (address, -1) ) > 0
-
Open sys_refcursor to select from the table variable?
Hello
I have a challenge for you! :-)
I have a procedure that has a lot of logic to determine which data should be loaded into a table variable. Because of various constraints of the application, I can't create a global temporary table. Instead, I would like to create a table variable and fill with stuff that I go through the procedure.
The final outcome of the procedure is that I must be able to pass the results as a sys_refcursor. It is a requirement that is beyond my control as well.
Is there a way to do this kind of work of the procedure?
Create Or Replace procedure Xtst
(
Mu_Cur in the Sys_Refcursor
)
Is
Type Xdmlrectype is Record (Col1 Varchar2 (66));
Type Xdmltype is Table of Xdmlrectype;
RTN Xdmltype;
Begin
Internal_Id Select Bulk collect into Rtn of Zc_State;
Open mu_cur to select table col1 (rtn);
end;
/
---
11/42 PLS-00642: types of local collections not allowed in SQL queries
11/36 PL/SQL: ORA-22905: cannot access the rows of a table not nested element
11/19 PL/SQL: statement ignored
Display errors;Not something I would personally like to implement.
But for educational purposes only of course...
create table this_will_be_gross ( column1 number, column2 varchar2(30) ); insert into this_will_be_gross values (1, 'begin the ugliness'); insert into this_will_be_gross values (2, 'end the ugliness'); variable x refcursor; ME_XE? declare Rtn sys.ODCIVARCHAR2LIST; BEGIN SELECT column1 || '-' || column2 Bulk Collect INTO Rtn FROM this_will_be_gross; OPEN :x FOR SELECT regexp_substr (column_value, '[^-]+', 1, 1) as column1, regexp_substr (column_value, '[^-]+', 1, 2) as column2 FROM TABLE(CAST(rtn AS sys.ODCIVARCHAR2LIST)); end; 17 / PL/SQL procedure successfully completed. Elapsed: 00:00:00.09 ME_XE? ME_XE?print :x COLUMN1 COLUMN2 ------------------------------ ------------------------------ 1 begin the ugliness 2 end the ugliness 2 rows selected. Elapsed: 00:00:00.11
In the above example I have "know" that a hyphen was a safe character to use to break my data items (as could not find anywhere in the data itself).
I strongly encourage you don't not to implement something like this. I know it's tempting when you work in harsh environments where it may take a serious battle to get structures such as temporary tables or the SQL Types created, but it is really the right way to do it.
-
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. -
I have 3 tables in my database...
Table1 with one column
Table1:
table1_id
11
12
13
14
Table2 with a single column
Table2
table2_id
21
22
23
24
Table 3 with 2 primary foreign keys of table1 and table2
Table 3
table1_id table2_id
11 21
11 22
12 23
12 24
13 21
14 22
I want a select statement that selects everything in table2 where the specified table1_id is not in the list of the table1_id in table 3
for example if I want the list of 11 IDs it should return (23, 24)
I came up with the following, but it didn't work
Select table2_id
of tabel3 c, table2 b
where table1_id <>11 and c.table2_id = b.table2_id
I know that my explanation is not clear...
but any effort will be appreciatedThat should do it. I have not create the tables, therefore not tested.
SELECT t3.table2_id FROM table_2 t2 INNER JOIN table3 t3 ON t2.table2_id = t3.table2_id MINUS SELECT t3.table2_id FROM table_1 t1 INNER JOIN table3 t3 ON t1.table1_id = t3.table1_id
-
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.
-
Select from the table on the highest priority
I have a table TAB1, who has, among other things, the 2 fields. FIELD1 is a non-unique ID and FIELD2 is a two character code. For example:
123, AA
123, AZ
124, BB
124, BY
I also have a second table TAB2 that contains 3 fields. Field1 + Field2 are two character codes and FIELD3 is an integer used as a priority. Tab2 is used as a translation table. For example:
AA, OO, 1
AZ, O2, 2
BB, OQ, 3
BY, P9, 4
What I would do is for each ID of TAB1, select the code of the TAB2 translation with the highest priority.
Any help appreciated.
Thank youuser12141187 wrote:
What I would do is for each ID of TAB1, select the code of the TAB2 translation with the highest priority.Assuming that 1 is the highest priority and 4 is the lowest:
select field1, field2 From ( Select t1.field1,t2.field2 ,rank() over(partition by t1.field1 order by t2.priority) rn from Tab1 T1,Tab2 T2 where t1.field2 = t2.field1 ) where rn = 1
Vivek L
-
SELECT from the table during a TRUNCATION operation...
Nice day
Environment: Oracle 10 g 2 EE on AIX and Crystal Reports/Crystal Enterprise (XI 3.1)
We have a table that is refreshed every 10 minutes throughout the day and night. Users run reports against the table pretty well any time they want. The table is updated through OWB by using the TRUNCATE/INSERT that first truncates the table and then reloads the entire table.
Opportunities random when the user runs the report at the same time as the update of the table, the user gets an error message from Crystal as follows:
Error in the file ~ tmp23206abf4faed20.rpt: impossible to extract the data from the database. Details: [database vendor Code: 8103]
In other cases, which is the one that I expect, the user sees a report empty and all simply of runs again the report. The report only takes a few seconds.
This error could be due to the Crystal report trying to get the data in the table at the EXACT time that the table is truncated?
Other thoughts are welcome!
Thank you very much!
-garyHi Gary,.
This behavior is described in MOS 170185.1
Concerning
Peter -
Provisioning of users from different areas, based on a user IOM attr field
Hi all
We have a requirement where we are supposed to supply to the users of a particular resource under certain conditions.
The scenerio is like:
In the screen of the user of the IOM, we get an attribute, for example say "Organization Id" which can have so-called values 'A', 'B' or 'C '. If the Id of the Organization has a so-called value 'A', then we need to check if the user is a case of rehire or not. Additional logic must be added if it is the case of rehiring. Once the complete logic is enabled, it must then assign the user to a particular group of which the user through the access policy will be put in service a particular resource to say 'ABC' FIELD.
If said the Organization Id value 'B', then we want directly to the user to be placed in service to a different DOMAIN, say "XYZ" once again using an access policy applied in a group.
Can you please let me know what would be the best possible approach to achieve this.
All entries will be very appreciated.
Concerning
NikhilThere are several ways to implement your requirements.
I would use an adapter of the entity to implement the Organization and to rehire logic check. Then I would put the user in different groups IOM with enclosed access policies provides the resources (see http://iamreflections.blogspot.com/2010/09/oim-howto-target-system-group.html)
To the different areas, you can either use an object resource with the domain set up in the ITResource or you can clone the connector and use a resource by domain object.
Best regards
/ Martin -
DB connectivity Kit: syntax error in a SELECTION of data from joined tables
Hello everyone
I'm putting in labview a SQL query on joined tables.
As an example I take a database to store the data of basketball 2on2 matches, which tables are
corresponds to (matchId, Thomas, teamB)
teams (teamId,PlayerAname, PlayerBname, nationality)
nationalities (NatId, natName)
To get an array of result with the game as well as the names of player as well as their nationality, I use this query on MySQL (which works on command line interface)
SELECT MatchID,
T1. PlayerAName, t1. PlayerBName, n1.natName,
T2. PlayerAName, t2. PlayerBName, n2.natName
MATCHES m
INNER JOIN teams t1 ON t1.teamID = m.teamA
INNER JOIN teams t2 ON t2.teamID = m.teamB
INNER JOIN nationalities L1 ON n1.natID = t1.nationality
INNER JOIN nationalities n2 ON n2.natID = t2.nationalityWhen I put it in labview, using the block 'select data', I get a syntax error as shown in the attached screenshot.
Am I something mistanking using the JOIN examples statements or aliases?
Thanks in advance!
The select VI is designed to be a simple way to select from a table. I doubt that he can do joins (and would not certainly need the 'FROM', even if it can). What you can do instead calls the query execute VI and give him the complete SQL query. I don't remember if it returns the data in the recordset object, so you must do so separately.
-
Load data from one table into another table of 2 different schemes
Hello
We have a requirement to insert data into a table in a schema of a table that is in other schemas in ODI.
We are able to do so by creating interfaces and mappings. But we now expect to do using SQL instead of ODI interfaces.
Is it possible to do this using the SQL statements we have source and target data sources defined in ODI.
should be like "Insert into src.table select * from tar.table'"
Thank you...
Hello
If you try to load a db to another db using sql (sql free hand) instead of interfaces instructions.
It is possible using procedures odi too.
1. Select the project (designer navigator) odi mode
2. create the new procedure. Then add the command.
in this command on the source command on the tabs of the target.
Enter the sql statements. See the screenshots below...
I think this will help for you,
Thank you best regards &,.
A.Kavya
Maybe you are looking for
-
Hi all I downloaded "Features of construction custom for NI VeriStand.pdf" Web site of NOR. I also downloaded code mentioned in the tutorial example. I copied the files uploaded to the respective locations as mentioned in the pdf file. When I try to
-
I use windows xp. on cpu 2.4, 1 gb ram and 256 of the hard drive. and I am aware of two pins in my processor is broken by the heat of combustion. the system still works fine. but the only problem that I face is that it takes 3 x the normal time to co
-
B2375dfw administrator privileges
I have a Dell B2375dfw all-in-one mono printer. The printer requires me to connect to do several things on the printer itself. This is a printer at home - I wish I could remove the connection. I created a connection with custom menus and other things
-
Add new Member and firmware update
Hello I have a group of 4 bays Equallogic 1xPS4000 (Type: 70-0120) and 3xPS6100 (Type: 70-0400) They all firmware v6.0.4 The new table is a PS6210XV. I'm sure that the firmware of it's newer probably with a release v7.x. The documentation for the fir
-
Can I install outlook express 8 on my windows 7
I would like to install outlook express 8 on windows 7? If yes I ohe do instructions