Unique records
I have two tables.
Table A table B
---------------------- ----------------------------------
Fund Dept Fund Dept
1 2 1 3
1 3 1 4
1 4 1 2
1 5 1 6
In the tables above, trying to get the column Dept of Table B which is not A Fund = 1 table.
For example, if I select Fund = '1', then I should get the Dept = 6 suite, because this department code is not in A table.
I tried some queries, but I always end up with a Cartesian product. Can you please help me.
Thank you.
Select dept
from tableb
where finance = 1
less
Select dept
from tablea
where finance = 1
/
SY.
Tags: Database
Similar Questions
-
retriving of unique records on two columns
Hello world
Using sql query, that he must retrieve unique records on two columns.
Example of table source: raster columns [uwi, well_no]
Examples of data below
UWI well_no
----- --------
1 988311
1 988311
1 1032662
1 1032662
2 103
2 103
2 103
3
3 104
3 104
3 104
4 106
4 107
4
4 108
For a given
UWI: 1 there are 4 well_no which is having two distinct values where these documents I need to go get
UWI: 2 there are 3 well_no, all 3 well_no contains the same value as (103) Consequently, these documents should not seek
UWI: 3 there are 4 well_no (1 null and 3 values are the same (104)] where these records should not seek.)
UWI: 4 there are 4 well_no which is to have three separate with a single value zero so these 4 files, I need to get.
output:
UWI well_no
----- --------
1 988311
1 988311
1 1032662
1 1032662
4 106
4 107
4
4 108
Thank you
Jery
Hi, Michel,.
Whenever you have a question, please post CREATE TABLE and INSERT statements for your sample data, so people who want to help you can recreate the problem and test their ideas.
Format your message so that it is easy to read and understand.
Always say what version of Oracle you are using (for example, 11.2.0.2.0).
See the FAQ forum: https://forums.oracle.com/message/9362002
Maybe you want something like this, which shows information about the jobs that have deptnos 2 or more not NULL:
WITH got_cnt AS
(
SOME jobs, deptno
, ACCOUNT (SEPARATE deptno) RESUMED (work PARTITION) AS cnt
FROM scott.emp
)
SOME jobs, deptno
OF got_cnt
WHERE cnt > 1
;
-
Find a UNIQUE RECORD on both sides
Hi, I want to find a unique record that is either A or B who wants to tell A NOT IN B & B NOT in one, here is the sample data
IF the START_DATE_TIME differ in 1 second, they are considered the same record, example: 77777733, 77777733, 20120625001608 in one hand is the same as 77777733, 77777733, 20120625001607 B sideA side ----------- A_SUB_NUM B_SUB_NUM START_DATE_TIME SIDE 88912345 88912345 20120625000031 A 77777733 77777733 20120625001608 A 77777733 77777733 20120625000000 A B side ----------- A_SUB_NUM B_SUB_NUM START_DATE_TIME SIDE 88912345 88912345 20120625000022 B 88912345 88912345 20120625000028 B 88912345 88912345 20120625000031 B 77777733 77777733 20120625001607 B
Here is my code, however it didtn give me the expected result that 88912345 have not been filter :(
Here is the data dictionary( SELECT START_DATE_TIME ,A_SUB_NUM ,B_SUB_NUM ,SIDE FROM TEST_A t2 WHERE (A_SUB_NUM, B_SUB_NUM ) NOT IN (SELECT A_SUB_NUM, B_SUB_NUM FROM TEST_B where ( start_date_time > to_char(to_date(t2.START_DATE_TIME,'yyyyMMddhh24miss')-60/86400,'yyyymmddhh24miss') and start_date_time < to_char(to_date(t2.START_DATE_TIME,'yyyyMMddhh24miss')+60/86400,'yyyymmddhh24miss') ) ) ) UNION ALL ( SELECT START_DATE_TIME ,A_SUB_NUM ,B_SUB_NUM ,SIDE FROM TEST_B t1 WHERE (A_SUB_NUM, B_SUB_NUM) NOT IN (SELECT A_SUB_NUM, B_SUB_NUM FROM TEST_A where ( start_date_time > to_char(to_date(t1.START_DATE_TIME,'yyyyMMddhh24miss')-60/86400,'yyyymmddhh24miss') AND start_date_time < to_char(to_date(t1.START_DATE_TIME,'yyyyMMddhh24miss')+60/86400,'yyyymmddhh24miss') ) ) ) This is the result from the query START_DATE_TIME A_SUB_NUM B_SUB_NUM SIDE 20120625000000 77777733 77777733 A Expected result should be START_DATE_TIME A_SUB_NUM B_SUB_NUM SIDE 20120625000000 77777733 77777733 A 20120625000022 88912345 88912345 B 20120625000028 88912345 88912345 B
Appreciate your help :)CREATE TABLE TEST_A (A_SUB_NUM VARCHAR2(50), B_SUB_NUM VARCHAR2(50), START_DATE_TIME VARCHAR(50), SIDE VARCHAR2(2) ); CREATE TABLE TEST_B (A_SUB_NUM VARCHAR2(50), B_SUB_NUM VARCHAR2(50), START_DATE_TIME VARCHAR(50), SIDE VARCHAR2(2) ); INSERT INTO TEST_B VALUES ('88912345' , '88912345' , '20120625000022', 'B'); INSERT INTO TEST_B VALUES ('88912345' , '88912345' , '20120625000028' , 'B'); INSERT INTO TEST_B VALUES ('88912345' , '88912345' , '20120625000031', 'B'); INSERT INTO TEST_B VALUES ('77777733' , '77777733' , '20120625001607', 'B'); INSERT INTO TEST_A VALUES ('88912345' , '88912345' , 20120625000031, 'A'); INSERT INTO TEST_B VALUES ('77777733', '77777733', 20120625000000, 'A'); INSERT INTO TEST_B VALUES ('77777733' , '77777733' , 20120625001608, 'A');
Hello
First of all, I want to note that there is a typing error in the last one you gave instructions insert. Instead of INSERT INTO TEST_B
VALUES ('77777733', '77777733', 20120625000000, ' A'), you probably want to post INSERT INTO TEST_A
VALUES ('77777733', '77777733', 20120625000000, ' A') and also instead of INSERT INTO TEST_B
VALUES ('77777733', '77777733', 20120625001608, ' A'), you probably want to post INSERT INTO TEST_A
VALUES ('77777733', '77777733', 20120625001608, ' A').Here is a solution to your problem:
select * from test_a; A_SUB_NUM B_SUB_NUM START_DATE_TIME SIDE -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---- 88912345 88912345 20120625000031 A 77777733 77777733 20120625000000 A 77777733 77777733 20120625001608 A select * from test_b; A_SUB_NUM B_SUB_NUM START_DATE_TIME SIDE -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---- 88912345 88912345 20120625000022 B 88912345 88912345 20120625000028 B 88912345 88912345 20120625000031 B 77777733 77777733 20120625001607 B select * from test_a where not exists (select * from test_b where abs(to_number(test_b.start_date_time) - to_number(test_a.start_date_time) ) <= 1 ) union select * from test_b where not exists (select * from test_a where abs(to_number(test_a.start_date_time) - to_number(test_b.start_date_time) ) <= 1 ) ; A_SUB_NUM B_SUB_NUM START_DATE_TIME SIDE -------------------------------------------------- -------------------------------------------------- -------------------------------------------------- ---- 77777733 77777733 20120625000000 A 88912345 88912345 20120625000022 B 88912345 88912345 20120625000028 B
-
extraction of unique records of registration of two different tables
Hello
In the following two tables different www.testing.com code exists in both tables. I want to compare two different columns from two different tables for unique records.
Thank you and best regardsSQL> select unique(videoLinks) from saVideos where sa_id=21; VIDEOLINKS ----------------------------------------------------------------------- www.testing.com SQL> ed Wrote file afiedt.buf 1* select unique(picLinks) from saImages where sa_id=21 SQL> / PICLINKS ----------------------------------------------------------------------- test test14 www.hello.com www.testing.com
Try
Select unique (videoLinks) in the saVideos where sa_id = 21
Union
Select unique (picLinks) in the saImages where sa_id = 21 -
How to retrieve unique records with multiple columns
I have a sps_prod table as described below-
POGNAME VARCHAR2 (1500)
INDEX #VERSION VARCHAR2 (200)
POG_MODEL_STATUS VARCHAR2 (100)
POG_LAYOUT_TYPE VARCHAR2 (500)
POG_MARKET_SPECIFIC VARCHAR2 (500)
POG_CONTACT_NUMBER VARCHAR2 (100)
AREA_SUPPORTED VARCHAR2 (500)
POG_COMMENTS VARCHAR2 (1500)
POG_FOOTER_COMMENTS VARCHAR2 (1500)
POG_ELECTRICAL_LIST_1 VARCHAR2 (1500)
POG_ELECTRICAL_LIST_2 VARCHAR2 (1500)
POG_CARPENTRY_1 VARCHAR2 (1500)
POG_CARPENTRY_2 VARCHAR2 (1500)
INSTALLATION_INSTRUCTION_1 VARCHAR2 (1500)
INSTALLATION_INSTRUCTION_2 VARCHAR2 (1500)
FIXTURE_REORDER_NUMBER VARCHAR2 (200)
FIXTURE_ID VARCHAR2 (200)
FIXTURE_NAME VARCHAR2 (500)
FIXTURE_IMAGE VARCHAR2 (500)
PART_REORDER_NUMBER_9 VARCHAR2 (500)
PART_FIXTURE_ID_9 VARCHAR2 (500)
PART_FIXTURE_NAME_9 VARCHAR2 (500)
PART_FIXTURE_IMAGE_9 VARCHAR2 (500)
UPC VARCHAR2 (50)
ITEM_NUMBER VARCHAR2 (50)
DESCRIPTION VARCHAR2 (700)
MERCH_TYPE VARCHAR2 (20)
HEIGHT VARCHAR2 (100)
WIDTH VARCHAR2 (100)
DEPTH VARCHAR2 (100)
DATE OF CREATE_TS
There are 4 million records in it and many with the same combination of POGName, #Version, POG_Model_Status, POG_Layout_Type, POG_Market_Specific, POG_Contact_Number and Fixture_Name Index. How do the records to retrieve all the columns above, but with a unique combination of fixture_name and reorder_number. It has no keys defined on the table.
I guess that it is a simple problem but the fact I'm trying to retrieve all the columns I'm stumbling.
Thanks in advance.Hello
Sanders_2503 wrote:
... There are 4 million records in it and many with the same combination of POGName, #Version, POG_Model_Status, POG_Layout_Type, POG_Market_Specific, POG_Contact_Number and Fixture_Name Index. How do the records to retrieve all the columns above, but with a unique combination of fixture_name and reorder_number.I don't see a column named reorder_number. Do you mean fixture_reorder_number or part_reorder_number_9?
So, you want only one row for each distinct combination of fixture_name and some other column (I'll assume it's fixture_reorder_number). Does it matter which line? They will not necessarily have the same values for the other columns.
The following query returns the one with the first pogname (in sort order):WITH got_r_num AS ( SELECT pogname, index#version, pog_model_status, pog_layout_type , pog_market_specific, pog_contact_number, fixture_name , ROW_NUMBER () OVER ( PARTITION BY fixture_name , fixture_reorder_number ORDER BY pogname ) AS r_num FROM sps_prod ) SELECT pogname, index#version, pog_model_status, pog_layout_type , pog_market_specific, pog_contact_number, fixture_name FROM got_r_num WHERE r_num = 1 ;
If there be a tie (i.e. two or more lines with the same fixture_name, fixture_number and pogname first) and then the will be chosen arbitrarily.
Instead of "ORDER BY pogname", you can ORDER all the other columns OR expressions, but you must have an ORDER byclause of analytics. You can do "ORDER BY NULL" If you really want pcik an arbitrary line.
I hope that answers your question.
If not, post a small example data (CREATE TABLE and only relevant columns, INSERT statements), and also publish the results you want from these data (or some examples of acceptable results).
Explain, using specific examples, how you get these results from these data.
Always tell what version of Oracle you are using. -
Hello
I need 6 unique random records from a table of query. Each record has a reference to an image, I am ulitmately want 6 images, but each must be unique and random.
Did anyone done this before? There is an available for this custom tag?
Thank you
KileyAfter help everybody I this Chuck of code in order to provide everyone who is facing the same question I did.
This provides a table with 6 elements of unique & random of the id of a table.
Thanks to everyone who helped me.
= #getAllDB_recordsAdsRet.xref_coupon_DB_records_id # >
-
selection of unique records-remove consecutive same data
Hello
I meet a table where in some cases x, y, msg_date_info fields are there... here, data are in large numbers... I need to recover the data in this table under the condition of the query.
It works very well...SELECT X longit,Y latit,MSG_DATE_INFO,row_number() over (order by MSG_DATE_INFO asc) SlNo FROM (SELECT distinct x,y,MSG_DATE_INFO,row_number() over (order by MSG_DATE_INFO desc) r FROM TRACKING_REPORT WHERE MSISDN='123456789') WHERE R between 1 and 20
Here again one thing I want to add up... this request leads to 20 rows as expected and I want to filter the records so consecutive x and y values of these lines are the same and give only unique values of x and y (provided that the same x and y can be there somewhere in the order of the data).
This example shows what are my needs in detail... and this is the output of the above query
>
80.20550609 13.09469998 8 March 10 19:23:23 1
80.20550609 13.09469998 8 March 10 19:28:37 2
80.20087123 13.09437811 8 March 10 19:33:25 3
80.20550609 13.09469998 8 March 10 19:38:24 4
80.20550609 13.09469998 8 March 10 19:43:25 5
80.20550609 13.09469998 8 March 10 19:48:25 6
80.20087123 13.09437811 8 March 10 19:53:25 7
80.20087123 13.09437811 8 March 10 19:58:24 8
80.20550609 13.09469998 8 March 10 20:03:25 9
80.20087123 13.09437811 8 March 10 20:08:24 10
80.20550609 13.09469998 8 March 10 20:13:24 11
80.20087123 13.09437811 8 March 10 20:18:37 12
80.20550609 13.09469998 8 March 10 20:23:32 13
80.20550609 13.09469998 8 March 10 20:28:25 14
80.20550609 13.09469998 8 March 10 20:33:23 15
80.20550609 13.09469998 8 March 10 20:38:24 16
80.20550609 13.09469998 8 March 10 20:43:24 17
80.20550609 13.09469998 8 March 10 20:48:24 18
80.20550609 13.09469998 8 March 10 20:53:22 19
80.20550609 13.09469998 8 March 10 20:58:24 20
>
This out, I need to filter the unique ROW values x and y and the output should be like
>
80.20550609 13.09469998 03/08/10 19:23 1
80.20087123 13.09437811 03/08/10 19:33 3
80.20550609 13.09469998 03/08/10 19:48 6
80.20087123 13.09437811 03/08/10 19:53 7
80.20550609 13.09469998 03/08/10 20:03 9
80.20087123 13.09437811 03/08/10 20:08 10
80.20550609 13.09469998 03/08/10 20:13 11
80.20087123 13.09437811 03/08/10 20:18 12
80.20550609 13.09469998 03/08/10 20:58 20
>
How to go about this requirement?
Edited by: Aemunathan 9 March 2010 17:45The following gives the same results on your test data, but perhaps it's more accurate because seeks two changes in x and y:
SQL> with mytab as ( 2 select 80.20550609 x, 13.09469998 y, '08-Mar-10 19:23:23' mydate, 1 rn from dual union 3 select 80.20550609,13.09469998, '08-Mar-10 19:28:37', 2 from dual union 4 select 80.20087123,13.09437811, '08-Mar-10 19:33:25', 3 from dual union 5 select 80.20550609,13.09469998, '08-Mar-10 19:38:24', 4 from dual union 6 select 80.20550609,13.09469998, '08-Mar-10 19:43:25', 5 from dual union 7 select 80.20550609, 13.09469998, '08-Mar-10 19:48:25', 6 from dual union 8 select 80.20087123, 13.09437811, '08-Mar-10 19:53:25', 7 from dual union 9 select 80.20087123, 13.09437811, '08-Mar-10 19:58:24', 8 from dual union 10 select 80.20550609, 13.09469998, '08-Mar-10 20:03:25', 9 from dual union 11 select 80.20087123, 13.09437811, '08-Mar-10 20:08:24', 10 from dual union 12 select 80.20550609,13.09469998, '08-Mar-10 20:13:24', 11 from dual union 13 select 80.20087123, 13.09437811, '08-Mar-10 20:18:37', 12 from dual union 14 select 80.20550609, 13.09469998, '08-Mar-10 20:23:32', 13 from dual union 15 select 80.20550609, 13.09469998, '08-Mar-10 20:28:25', 14 from dual union 16 select 80.20550609, 13.09469998, '08-Mar-10 20:33:23', 15 from dual union 17 select 80.20550609, 13.09469998, '08-Mar-10 20:38:24', 16 from dual union 18 select 80.20550609, 13.09469998, '08-Mar-10 20:43:24', 17 from dual union 19 select 80.20550609, 13.09469998, '08-Mar-10 20:48:24', 18 from dual union 20 select 80.20550609, 13.09469998, '08-Mar-10 20:53:22', 19 from dual union 21 select 80.20550609, 13.09469998, '08-Mar-10 20:58:24', 20 from dual 22 ) 23 select x, y, mydate, rn from ( 24 select x, y, mydate, rn, nvl(lead(x) over (order by rn),0) next_x 25 , nvl(lead(y) over (order by rn),0) next_y 26 from mytab 27 ) where next_x != x or next_y != y; X Y MYDATE RN -------------------- -------------------- ------------------ -------------------- 80.20550609 13.09469998 08-Mar-10 19:28:37 2 80.20087123 13.09437811 08-Mar-10 19:33:25 3 80.20550609 13.09469998 08-Mar-10 19:48:25 6 80.20087123 13.09437811 08-Mar-10 19:58:24 8 80.20550609 13.09469998 08-Mar-10 20:03:25 9 80.20087123 13.09437811 08-Mar-10 20:08:24 10 80.20550609 13.09469998 08-Mar-10 20:13:24 11 80.20087123 13.09437811 08-Mar-10 20:18:37 12 80.20550609 13.09469998 08-Mar-10 20:58:24 20 9 rows selected.
Max
http://oracleitalia.WordPress.com -
convert multiple records of unique records...
can someone help pls to convert this two records into one record for each account?
Here is the table. For each account, there will be two records for two dates.
It is to say, opening date and closing with the opening and the closing balance.
I want to appear as a single record.
the opening balance will be the least date and next day will be the closing balance.
Note: If there is there is only one record for an account, then this would be considered
date of opening and the opening balance. date and closing balance sheet will be null.
Oracle 11g
CREATE TABLE TEST2 ( RECORD_TYPE VARCHAR2(5 BYTE), ACCOUNT_NO VARCHAR2(12 BYTE), BALANCE_DATE DATE, SD_BALANCE NUMBER(18,4) ); SET DEFINE OFF; Insert into TEST2 (RECORD_TYPE, ACCOUNT_NO, BALANCE_DATE, SD_BALANCE) Values ('ABAL', '0105070411', TO_DATE('02/02/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -6611663.15); Insert into TEST2 (RECORD_TYPE, ACCOUNT_NO, BALANCE_DATE, SD_BALANCE) Values ('ABAL', '0105070411', TO_DATE('02/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -6611663.15); Insert into TEST2 (RECORD_TYPE, ACCOUNT_NO, BALANCE_DATE, SD_BALANCE) Values ('ABAL', '0105071013', TO_DATE('02/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -1321170); Insert into TEST2 (RECORD_TYPE, ACCOUNT_NO, BALANCE_DATE, SD_BALANCE) Values ('ABAL', '0105071013', TO_DATE('02/02/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), -1321170); Insert into TEST2 (RECORD_TYPE, ACCOUNT_NO, BALANCE_DATE, SD_BALANCE) Values ('ABAL', '0106071012', TO_DATE('02/02/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 1321170); Insert into TEST2 (RECORD_TYPE, ACCOUNT_NO, BALANCE_DATE, SD_BALANCE) Values ('ABAL', '0106071012', TO_DATE('02/01/2010 00:00:00', 'MM/DD/YYYY HH24:MI:SS'), 1321170); COMMIT; I am looking for record_type account_no opening_date opening_balance closing_date closing_balance ABAL 0105070411 20100201 -6611663.15 20100202 -6611663.15 ABAL 0105071013 20100201 -1421173 20100202 -1321170 ABAL 0106071012 20100201 1341170 20100202 1321170
select record_type, account_no, min(BALANCE_DATE) opening_date, min(SD_BALANCE) opening_balance, max(BALANCE_DATE) closing_date, max(SD_BALANCE) closing_balance from test2 group by record_type, account_no;
-
Have unique records in the table
Hello
I have this code I'm trying to make sure my table (MESSAGES) has no PASSPORTNO double and CUSTOMER_ID. Here is my code:
I got and error:DECLARE CURSOR C6 IS SELECT PASSPORTNO,CUSTOMER_ID,AMOUNT FROM MESSAGES; BEGIN for c2_rec2 in C2(i.passportno) loop DBMS_OUTPUT.PUT_LINE(i.passportno||' '||i.customer_id||' '||c3_rec.AMOUNT); for c4_rec in C4(i.passportno) loop FOR C5_REC IN C5(C4_REC.CUSTOMER_ID) LOOP IF (C6%FOUND) then if C6.PASSPORTNO (NOT EQUALS symbol) i.passportno and C6.CUSTOMER_ID (NOT EQUALS symbol) i.customer_id then INSERT INTO MESSAGES (PASSPORTNO,CUSTOMER_ID,AMOUNT) VALUES (I.PASSPORTNO,C4_REC.CUSTOMER_ID,C5_REC.AMOUNT); else DBMS_OUTPUT.PUT_LINE('DUPLICATE VALUES IN MESSAGES TABLE'); END IF; END IF;
PLS-00225: subprogram or cursor "C6" reference is out of reach
How am I suppose to change my code?hi lee, if you are using cursor for loop, you dont need %found, further more you dont open cursor c6, you can only find cursor c6 when you open it also in dont understand what you trying to do here, if C6.PASSPORTNO i.passportno and C6.CUSTOMER_IDi.customer_id theninsert , as per my understanding code should look like this, c2, c5 and c6 should be parameterized cursor for c2_rec2 in C2(i.passportno) loop DBMS_OUTPUT.PUT_LINE(i.passportno||' '||i.customer_id||' '||c3_rec.AMOUNT); for c4_rec in C4(i.passportno) loop FOR C5_REC IN C5(C4_REC.CUSTOMER_ID) LOOP for c6_rec in c6 (your parameter) loop INSERT INTO MESSAGES (PASSPORTNO,CUSTOMER_ID,AMOUNT) VALUES (I.PASSPORTNO,C4_REC.CUSTOMER_ID,C5_REC.AMOUNT);end loop for c6;
-
Dear all,
I would be happy to know if you have an experience to enable true single record ownership for data blocks. It works for basic blocks, but I need to work also for data blocks. The compiler ignores this property when I run. I would like to enable this property for forms including the unique records. I don't like not up/down cursor moves to a different record in a single registration form. So, if no other alternative is available by you, I would be happy to hear it too.
Thanks for the answers in the future,
MERICAnother possibility is to disable all keyboard actions (by putting the NULL; in the case KEY-triggers) that can be used to navigate to the second record, as
KEY-NXTREC
KEY-NXTSET
KEY PRESS
KEY-CREREC
KEY-DELREC -
Hello world
I want a little help to get some unique records in the table. I know that it can be very easy, but I don't know why I can't
Please help me
I'm working on Oracle 11 g DB and I use the plsql allround automation tool
I want to give example so that it will be very easy to understand
Table1 below.
CREATE THE TABLE1 TABLE:
(contract not null, number (10))
number (10) client.
delivery_type number (10));
insert into table1 values (1,1,1);
insert into table1 values 2.2.1;
insert into table1 values (2,22,1);
insert into table1 values (3.3.1);
insert into table1 values (3,33,1);
insert into table1 values (3,333,1);
Select * from table1;
CONTRACT CUSTOMER DELIVERY_TYPE 1 1 1 1 2 2 2 1 3 2 22 1 4 3 3 1 5 3 33 1 6 3 333 1 as you can see for the contract 2 and 3 I get 2 & 3 lines (since the clients are different I agree we receive multiple contracts)
but in that contract 2 and 3 I don't want that these contracts including a corresponding customers in another table with a type_code = "email".
create the table2 table
(customer number (10),)
Type_Code varchar2 (10));
insert into table2 values (22, 'EMAIL');
insert into table2 values (33, 'EMAIL');
insert into table2 values (333, 'EMAIL');
Select * from table2;
CUSTOMER TYPE_CODE 1 22 E-mail 2 33 E-mail 3 333 E-mail now I want a query that gives me the result like this
but I want the result like this
CONTRACT CUSTOMER DELIVERY_TYPE 1 1 1 1 2 2 22 1 3 3 33 1 4 3 333 1 I also want that contract 1
So basically I want all contracts, but if all contracts were duplicated (2 or 3 lines), I wanted to choose only the customers that has the matching condition in another table.
Something like this should work:
WITH account as
(SELECT t1.*, COUNT (*) (PARTITION BY contract) c FROM table1 t1)
SELECT * FROM account c
WHERE c = 1
OR EXISTS (SELECT 1 from table2 WHERE customer = c.customer AND type_code = "E-MAIL address"); -
Media Center is Reporting insufficient disk space for each record programmed
Since the upgrade to Windows 8 Media Center reports that there is not enough disk space for each scheduled TV recording despite there are currently more than 1 TB of free space. The programs record very well, but it is impossible to tell when it is a genuine issue (for example, a program conflict) as an indicator of each scheduled recording is also problematic.
There is a simple solution to this in Media Center as an administrator (which implies that there may be a problem of permissions with Windows 8). However, I also use an XBox 360 as an Extender and there is no known method to apply this workaround to an Extender then it continues to be a lack of disk space for each unique record.
I tried completely removing the recorded TV folder, followed by a reboot to allow Media Center services recreate the folder, but it does not solve the problem. I checked all the settings and Media Center reports that it has enough free space to save more than 400 hours of television, but he's still complaining lack of disk space for each individual scheduled recording.
Any ideas?
I found a solution that worked for me on another thread.
See the post from Steve Scoltock on executing a recovery job in the computer management application, here:http://answers.Microsoft.com/en-us/Windows/Forum/windows_8-Winapps/Windows-8-TV-recording-problem-with-Windows-Media/f9695954-246F-4C59-8d1b-3729a81feee9?page=1&TM=1352456456164It worked for me. I hope this guy helps too. -
Hi all
Our portfolio currently has 2 records of entry. 1 POINT 2. PRICE. For each element in the ELEMENT file, there may be multiple records of price in the PRICE file. It may be a situation where a particular item does not any price all (items expired). We do LEFT JOIN between the ITEM and the PRICE.
Now the problem is, we have created a file called "rec_spec" PRICE column and this acts as a record spec in our pipeline because it is unique in the PRICE file. But when we left join with records ARTICLE, for everything which has aura spec record prices and expiry of the elements will not record spec. This creates a huge amount of logs in the file dgidx.log as the warning for records that does not record spec. Our client wants to get rid of these messages to the log file. How can I go ahead with it? Is there a way in which short creates a unique record specification for all records after the left join? Help, please.
Also, we can create a spec record only in the CHECKPOINT file after a left join with records of PRICE multiple records can contain same record spec and baseline_update will throw an error.
Thanks in advance,
SAV
Hey Sav,
As you've identified, the RecSpec must be unique - and there are two ways you can go about this.
#1-allow DGIDX to create automatically; If you do not specify a property to act as the RecSpec and provide him with all the values, then it will work similar to a standard database and create its own index. Is not the preferred method, because it prevents from being able to perform partial updates - if you cannot re-create the key used, so how can update you the record?
#2-create your own RecSpec, as you do now with the PRICE file in the pipeline. As you've identified however, if you have an empty RecSpec or duplicate, an error is generated.
It is a common problem with the scenario you have described, since when there isn't a game on the left of the join and results in a key blank. I suggest to use a component of manipulator, as a manipulator of Record, as a result of the join to create the RecSpec. There is no need to use only a source on the ground, in effect when you use multiple data sets (such as products, how - to articles) recreate us our RecSpecs later.
My suggestion would be to abandon a manipulator after the join with the following behavior:
- Retrieve a single value in the CHECKPOINT file, like Item_ID, Product_ID, etc., as the first part of the key.
- If a moment ago key in the PRICE file (showing that this isn't an expired product), add the extra key (rec_spec) from him on the identifier of the ITEM
- Optionally, you could add a '_EXPIRED' on the item ID if there is not a match with PRICE
In this way each element will have a unique RecSpec, which could be recreated if necessary.
-
SQL query to get non-unique values
Hello
I'm using oracle 11g.
I have a table (T1) with data below and you want to insert the value in another table (T2).
CITY STATE
--------------- --
San Francisco CA
Palo Alto CA
Sarasota FL
New York NY
Boston NY
Boston COA unique constraint on the city and the State of the columns are given in table 2.
I want to filter non-unique records before inserting data in table 2 to avoid the UNIQUE constraint exception.
Thus, in the example above, the query should display subfoldersBoston NY
Boston COany ideas?
Thank you
Hello
EmAar says:
Sorry Chris/Frank, I should have been more specific.
Here is an actual table data.
description of the category
Costumes of a1
Costumes of a1
Costumes of a1
A9 crew sweats
A9 crew sweats
CK recreation Rep
CK Rep Tees
K9 Casual
Formal K9
K9 TRAIL RUNNING
As you can see, the category A1 and A9 are duplicated with the same description. On the other hand, CK & K9 have different descriptions.
I need a query to display CK & K9 because they have different descriptions against the same category.
hope that make sense?
It makes sense, but it's still vague; you really need to post CREATE TABLE and INSERT statements for entry and the exact result wish you get.from of these data.
My best guess is that you want:
SELECTED category
OF THE real
GROUP BY category
After HAVING COUNT (DISTINCT description) > 1
;
-
Need to create unique Recordset
Version Oracle = database Oracle 11 g Express Edition Release 11.2.0.2.0 - Production
Hi gurus
I have the following data and you must create the unique record set using an increment in the columns of sysdate.
Examples of data
as with a reference
(
Select 'abc' ID, sysdate date1 of union double all the
Select 'xbc", sysdate from dual union all
Select "zzz", double sysdate)
Select * reference;
------------
I have a unique constraint with the combination of ID and date1 and want this kind of query in which I can achieve different date1 by rank. Thanks in advance
Concerning
Shu
Check the query with interval, each line having 1 second difference
ALTER session set nls_date_format = 'YYYYMMDDHH24MISS ';
as with a reference
(
Select 'abc' ID, sysdate date1 of union double all the
Select 'xbc", sysdate from dual union all
Select "zzz", double sysdate)
Select id, date1 + numtodsinterval(rownum,'second') reference new_date;
Output
ABC 20140506105546
XBC 20140506105547
zzz 20140506105548
Maybe you are looking for
-
Why need to restart the computer 2 x front can launch Thunderbird?
When 1 computer startup, thunderbird says not responding do not. can not launch internet explore also. reboot again both can launch... using Windows vista. no problem when 1st installed. can use for a few months.
-
I need a link drievr for win 7 32 or 64-bit model: computer office pavilion 500 - 040l win 7 32-64 bit
-
I can't uninstall mse, I get a message saying that I need epp.msi
I tried to uninstall the upgrade and all I get is epp.msi is not installed. Child1
-
SmartWatch 3 screen won't stay on any actions of the wrist
Essentially what title says Watching about 6 months 1st time that I had a problem. Always on screen is defined but shuts off and only lights up with touch screen do not twist of the wrist. Watching is at 80% battery and we tried to turn on/off, resta
-
Mixture of blackBerry software connects no more
My passport and formerly connected mixture won't work together more, nor on my home PC and my work PC. Work PC runs win8.1, win7 home. PC mix version is 1.2.0.50, if I run freshly downloaded installer, it says that it is up-to-date. I did the control