A query table subquery that references a parent?

Well well, my problem (which I hope it has a solution :)) is the following:)

I'm working on a little project of advertising of the OS.

When an advertiser wants to launch a campaign, see the list of Publisher Web sites where it can advertise!
: SELECT [...] SITE visited [...]

With the number of places
::::[...] Count (place.ID) AS placeCnt [...] INNER JOIN place ON place.website_id = wsite.id [...]

-Yes, but the Web sites that have at least 1 place
::::[...] GROUP BY wsite.id HAVING COUNT (place.id) > 0 [...]

- And here is my problem of large dead end:
I would like to remove the Web sites where the advertiser can not the advertiser.
By that I mean > if each ads of the advertiser are put to the index for the "google.com" site, it can not see 'google.com' in the list because it will not be able to advertiser on in any case.
However, if the advertiser has 4 ads, and all this on black list except the 4th, he must see 'google.com' because it can advertise with the #4 announcement.

There are 2 types of blacklists:
targeted (by setting an identifier of website on the line of the blacklist)
overall (by setting the id site = null, so for example, if in the world, ad #1 is blacklisted by user #1, ad #1 couldn't be able to advertise on all the user's site #1)

I thought I found a solution put doesn't seem to work:
: WHERE 0 <)
SELECT COUNT (DISTINCT ad.id)
From ad
LEFT OUTER JOIN blacklist bl ON bl.ad_id = ad.id AND (bl.website_id = wsite.id OR bl.site_id IS NULL)
WHERE ad.user_id = $userid
AND bl.id IS NULL
)

An example of a concrete scenario: (SQL included at the end of the post)

the user (userid = 2) [email protected] has 3 ads.
-"my forbidden ad' (id = 1)
-"my ad' (id = 2)
-"my misunderstood ad' (id = 3)

the user (userid = 1) [email protected] there are 3 Web sites
-google.com (id = 1)
-yahoo.com (id = 2)

[email protected] has developed the index the following announcements:
-"my ad unknown" ON yahoo.com, target, type (website_id = 2, ad_id = 3, publisher_id = 1)
-type of "my ad banned" overall, (website_id = null, ad_id = 1 publisher_id = 1)

the publisher sites we will see with the resulting query should be (as the the advertiser, user 2):
Google.com
Yahoo.com
lol.com

WHY?
-Because the advertiser can advertise with ad 2 (ad2 is authorized to advertise on every Web site)
-Even if 'banned ad' started the index in the world, unapprediated ad is for google.com

Now, if the editor adds another limitation of the blacklist
-"my ad', type global (website_id = null, ad_id = 2, publisher_id = 1)

the result would be (as the the advertiser, user 2)
Google.com

WHY?
-Because the advertiser have not any announcement put on yahoo.com. AD 1 and Ad 2 are on the black list in the world, ad 3 is blacklisted for yahoo.com

WELL, I thought I found the solution by this request, but mysql returns an error > unknown colum on the subquery

The only thing I want is to LINK the parent WITH the bl.site_id = psite.id query WE subquery

Finally, all pour something that seemed to be possible with this request but which returns so an unknown column error:

SELECT wsite.*, COUNT (place.id) AS placeCnt
WEBSITE visited
INNER JOIN place ON place.website_id = wsite.id
WHERE 0 <)
SELECT COUNT (DISTINCT ad.id)
From ad
LEFT OUTER JOIN blacklist bl ON bl.ad_id = ad.id AND (* bl.website_id = wsite.id * OR bl.website_id IS NULL)
WHERE the ad.advertiser_id = 2
AND bl.id IS NULL
)
GROUP BY wsite.id
HAVING COUNT (place.id) > 0

Well WELL thank you VERY MUCH for reading this post, AND THANK YOU EVEN MORE IF someone FIND A TRICK!

PS:

(the only solution I see for now is a loop like)
foreach ($publisher_sites as $s) {}
[if (advertiserCanAdvertiser ($s ['id'])) $sites] = $s
}

but the performance is really bad

I think that the following might help :)

/*

Transfer of data from MySQL

Source Host: localhost

The source database: orads

Target host: localhost

Target databases: orads

Date: 2009-10-20 13:02:03

*/



SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------

-Structure of the table for ad

-- ----------------------------

DROP TABLE IF EXISTS 'ad ';

CREATE TABLE 'ad')
'id' int (11) NOT NULL auto_increment,
'title' varchar (32) NOT NULL,
'url' varchar (50) NOT NULL,
'advertiser_id' int (11) NOT NULL,
PRIMARY KEY ('id')
) ENGINE = MyISAM AUTO_INCREMENT = 4 DEFAULT CHARSET = utf8;



-- ----------------------------

-Structure of the table for the black list

-- ----------------------------

DROP TABLE IF EXISTS 'black list ';

CREATE TABLE 'black list')
'id' int (11) NOT NULL auto_increment,
"ad_id' int (11) NOT NULL,
"website_id' int (11) default NULL,
"publisher_id' int (11) NOT NULL,
PRIMARY KEY ('id')
) ENGINE = MyISAM AUTO_INCREMENT = 3 DEFAULT CHARSET = utf8;



-- ----------------------------

-Structure of the table for the place

-- ----------------------------

DROP TABLE IF EXISTS 'place '.

CREATE TABLE 'place')
'id' int (11) NOT NULL auto_increment,
'name' varchar (32) NOT NULL,
"website_id' int (11) NOT NULL,
PRIMARY KEY ('id')
) ENGINE = MyISAM AUTO_INCREMENT = 5 DEFAULT CHARSET = utf8;



-- ----------------------------

-Structure of the table for the user

-- ----------------------------

DROP TABLE IF EXISTS 'user '.

CREATE TABLE 'user')
'id' int (11) NOT NULL auto_increment,
'email' varchar (64) NOT NULL,
varchar (16) "password" NOT NULL,.
PRIMARY KEY ('id')
) ENGINE = MyISAM AUTO_INCREMENT = 3 DEFAULT CHARSET = utf8;



-- ----------------------------

-Structure of the table for Web site

-- ----------------------------

DROP TABLE IF EXISTS 'Web site ';

CREATE TABLE "Web site")
'id' int (11) NOT NULL auto_increment,
'title' varchar (32) NOT NULL,
'url' varchar (32) NOT NULL,
"publisher_id' int (11) NOT NULL,
PRIMARY KEY ('id')
) ENGINE = MyISAM AUTO_INCREMENT = 4 DEFAULT CHARSET = utf8;



-- ----------------------------

-Documents

-- ----------------------------

INSERT INTO 'ad' VALUES ('1', ' ' my ad banned 1', 'http://www.no.com', 2 ');

INSERT INTO 'ad' VALUES ('2', ' ' my ad 2', 'http://www.lol.com', 2 ');

INSERT INTO 'ad' VALUES ('3', ' ' my misunderstood ad 3', 'http://www.abc.com", 2");

INSERT INTO 'black list' values ('1 ', ' 1', null, ' 1');

INSERT IN the 'black list' VALUES ('2', '3', '2', 1');

INSERT INTO 'place' VALUES ('1', 'banner1', ' 1');

INSERT INTO 'place' VALUES ('2', 'banner yahoo', '2');

INSERT INTO 'users' VALUES ('1', '[email protected]', 'editor');

INSERT INTO 'users' VALUES ('2', '[email protected]', 'advertiser');

INSERT INTO 'Web site' VALUES ('1', 'google', 'http://www.google.com', '1');

INSERT INTO 'Web site' VALUES ('2', 'yahoo', 'http://www.yahoo.com', '1');

Published by: user12086067 on October 20, 2009 04:51

Hello

Welcome to the forum!

Interesting problem!

Here's a way to do it in Oracle:

SELECT DISTINCT     w.*
FROM     website     w
JOIN     place     p  ON     p.website_id     = w.id
JOIN     ad     a  ON     w.publisher_id     NOT IN (
                                SELECT     b.publisher_id
                                FROM     blacklist     b
                                WHERE     b.ad_id     = a.id
                                AND     COALESCE ( b.website_id
                                                , w.id
                                         ) = w.id
                                )
WHERE     a.advertiser_id     = 2     -- parameter
;

Thanks for posting the CREATE TABLE and INSERT. Since this is a forum for Oracle, you should post statementts that will work in Oracle.
I don't know anything about MySQL, so I don't know whether you need to change the query that precedes.

This isn't quite produce the output you asked, because lol.com is not in the table Web site. Do you need to get the lol.com of the table user somehow?

Tags: Database

Similar Questions

  • Killing a long query with a remote reference

    The following query has been run on a local database that references tables in a remote database. I wanted to kill the session running on the local database which I did and saw that it was marked for kill. The session continued to run for hours on the local database and someone finally killed a session for this on the remote database, which was done successfully.


    SELECT Row_id
    OF S_CONTACT
    WHERE con_cd = 'customer '.
    AND ROW_ID not in
    (
    SELECT CON_ID
    OF S_POSTN_CON
    )
    less
    SELECT Row_id
    OF S_CONTACT@remote_db
    WHERE con_cd = 'customer '.
    AND ROW_ID not in
    (
    SELECT CON_ID
    OF S_POSTN_CON@remote_db
    )


    This problem has prompted a number of questions that I can't find answers for:

    (1) when I kill a local session that began a remote session no matter what to get communicated to the remote session to kill him?

    (2) what SQL actions must be performed before a session can be terminated? I am aware that restores must fill. Does include writing to the implicit tables for queries?

    (3) what is the correct procedure for the murder of sessions and remote sessions?

    Thank you

    Richard

    >
    The local database is a database of test that I have limited privileges.
    >
    If your process is not to intervene 'real' on each server, then you must use SESSION DISCONNECTION. . IMMEDIATE.
    Which will remove the process from the server to your test database, as well as the remote database.

    I mean by 'real' work that you don't care if it gets rolled back or not. If you make updates on the remote server, only those who should be cancelled. But if you're just do queries on the remote server, then there isn't really any significant restoration to do.
    >
    What was causing the delay in the 2 sessions to terminate?

    When, if ever, would be word get remote session let know it must end?
    >
    Depends on what you were doing. If you were doing a distributed query and Oracle selects one of the tables at the table of the conduct and the server associated with the conduct 'site '. In your case if driving site was the prod server then the other data in the table in your local server request will be sent to the production server and the executed query.

    Until the remote server has something to report back it will just keep chugging along so in some cases, it might run for hours.
    If the equivalent FIRST_ROWS or similar was used then the remote server must declare at the time when it was the first set of data which would normally be quite quickly.

    But if you were doing a NEGATIVE sign and then the remote server cannot have lines of result until he arrives at the end of one of the tables. This is because the first row, he might want to return might be identical to the last line to be examined in the other table. If the two tables were 100 million lines so still no way to select even a line for the game because the rest of the other row table could be his twin of results which were absolutely identical there.

    Looks like you have about the worst case for trying to kill the remote session. I have seen «killed» sessins hang out for a few weeks before finally get cleared out.
    >
    I have to go to the remote database and kill this session myself as well?
    >
    Yes - as soon as you know that you no longer want the remote session you should take measures for killing, or disconnected. Killed if you want things restored - disconnected if you care.
    >
    Oracle wouldn't better able that track and do it?
    >
    How do you think Oracle to make a judgment on what are your business processes?

    Suppose that you scenario were to just launch a standalone process on the remote server, and then wait to be notified that it is complete.
    But you do not use Advanced Files or other asynchronous process. From the perspective of enterprise remote task should continue until the end Oracle may not know what you want to do in this particular case.

  • Conflict table chart control reference

    My vi has 6 graphics, and I need to change them through nodes of property through on my vi, then I wanted to store all references to graph in an array and pass it.  When I do that, I'm a class conflict between my entry table and a table in the cluster.  They are two waveform signals Refnum (strict), so I don't know why there is a conflict.  See the attachment for more info.

    I will usually use a group instead of a table so that I can access all the properties, but in your case...

    Unplug the broken wire, create an indicator of the output of the generation of table.

    Copy it and go back and change your type def and replace the stone with your new version. He should associate after that.

    Note:

    In your Subvi (if you stik with the table) you may need to perform the wire (more specific) class get the properties you need.

    Ben

  • SubVIs cannot reference the Parent controls

    Is there anyway that a Subvi can reference controls on the façade of a relative of VI? Without this ability, it is difficult to reduce the complexity of a VI using subVIs, when a front panel control is involved. Variable property nodes do not seem to be the ability to reference a control in a VI parent. Is it possible to fix this?

    There are two ways to do this:

    1. use the connector pane to indicate the reference to control of the Subvi.

    2. open a VI reference to parent VI or get the reference through the connector pane. Use the [VI:Controls] property node to get references to all of the controls. You must use a loop to get good verification of the label control. As far as I know, the sequence is in the tab order in order to be able to use an index.

  • I receive in my Start menu another instance of Firefox to select that reference the site pornhub, which went never consciously to. How permanently remove this instance in my Start menu?

    I have the menu item "Mozilla Firefox" habitual, frequent of the websites listed in my Start menu in Windows 7. But another element of Mozilla Firefox/instance appear very often in my Start menu that references the site pornhub. I was never consciously
    This site and did NOT want to see it listed in my menu start.
    How can I permanently remove or disable this?

    Do a check with some malware malware, analysis of programs on the Windows computer.

    You need to scan with all programs, because each program detects a different malicious program.

    Make sure that you update each program to get the latest version of their databases before scanning.

    See also:

  • Suppose I have a table emp that has thousands of lines of data. In this table, I have to get only the employees whose salary is equal.

    Hello world

    Suppose I have a table emp that has thousands of lines of data. In this table of employees receive wages between 1000-10000.

    Now I have to get only the employees whose salary is equal.

    for example

    empNo empName sal

    -----------     -------------      ---------

    1 ram 5000

    2 5000 Shyam

    3 1000 Dilip

    4 deepak 2000

    5 sisi 1000

    6 1000 Priya

    so now...

    Now without using ' select * from emp where Sal IN (5000,1000). "How can I get these employees with the same salary?

    SELECT *.

    EMP e1

    WHERE EXISTS (SELECT 99 FROM emp e2 WHERE e2.sal = e1.sal AND e2.empno! = e1.empno)

    or maybe

    SELECT *.

    WCP

    WHERE sal IN (SELECT sal FROM emp GROUP BY sal HAVING COUNT (*) > 1)

  • import of comps that reference the same project files without doubling the size of the ae file?

    Hello, I am currently working on a major project that has me constantly to reimport old comps that reference the same project files. The thing is that when I do this AE re-imports all project again files when it is attached to the computer that I imported. My question is is there a (fast) way to remove references of redundant project in the project tab file, or there at - it another way to import a model without creating this double entry in the project tab?

    Thank you guys!

    Sorry, Yes, you can do this by using the command consolidation (file > consolidate all sequences).

    This will remove all duplicates.

    See this Help on AE page for more information.

  • Is it possible to create interactive drop-down lists that reference the tables on pages separate from the PDF?

    I'm looking to create a user to input PDF in the drop-down lists are used to search for tables, however, I'm not very familiar with the options that are available or if this is even possible?  Also, is it possible to write a substantive code that could read the text of the user entered to perform a search or even solve an equation? Can someone let me know if these elements are possible and/or let me know what adobe program may be required to accomplish these tasks? Thank you!

    PDF documents have no concept of "tables" as MS Word or MS Excel has. There is content that looks like a table.

    Acrobat JavaScript knows tables and form fields. So we could have a table in JavaScript and complete a series of fields that looks like a table. You can use JavaScript to find the table.

    JavaScript in Acrobat can accept user entries in the fields and pop-up windows.

    It is possible to solve theoretical equations the user if the good rating or coding is used.

    D.P. Story is an evangelist generated LaTex PDF to create PDFS with mathematical symbols, and he also created the AcroTex product that allows to create educational tools that includes mathematics calculation self placement tests.

  • Update statmnt w / nested subqueries? Works only if create table subquery

    I'm trying to update a table by finding the best matches 'of' another table (better = I'm comparing two DateTime fields to find the closest match).

    The basic update is like this:

    Update table
    (columns) of the game = (query1 (of query2 [join join (query4) (query3) (query5)]))

    When I run the present it seems to work forever. But when I create a temporary table query2-5-based and run it, it takes a few seconds.

    I don't know why the approach of nested sub query takes so long. Any ideas as to why? (or is there a better way to make the 'match'?)


    In case I get flamed for not providing enough detail below is the actual code...
    UPDATE inpatient_linker il
    SET        (IL.PP_SEQU, IL.REDIS_ARRIVAL_DT, IL.REDIS_DISCHARGE_DT, IL.REDIS_DISP_DESC, IL.REDIS_ED_SITE)
             = (SELECT      dd.PP_SEQU, dd.ARRIVAL_DT, dd.DISCHARGE_DT, dd.DISP_DESC, dd.ED_SITE
                FROM        (
                            SELECT      aa.PP_SEQU, aa.ARRIVAL_DT, aa.DISCHARGE_DT, aa.DISP_DESC, aa.ED_SITE, aa.ENCOUNTER_NO
                            FROM        (           -- all combinations of pp_sequ and encounter_no that match within tolerance of half a day
                                        SELECT      RV.PP_SEQU, IL.ENCOUNTER_NO, ABS(RV.DISCHARGE_DT - IL.CLINIBASE_ADMIT_DT) AS score,
                                                    rv.ARRIVAL_DT, rv.DISCHARGE_DT, rv.DISP_DESC, rv.ED_SITE
                                        FROM        hsa_tgt.REDIS_VISITS rv,
                                                    inpatient_linker il
                                        WHERE       RV.PHN = IL.PHN
                                                AND RV.PT_GENDER = IL.GENDER
                                                AND RV.PT_DOB = IL.BIRTH_DT
                                                AND RV.DISCHARGE_DT BETWEEN IL.CLINIBASE_ADMIT_DT - 24/24 AND IL.CLINIBASE_ADMIT_DT + 12/24
                                                AND RV.DISCHARGE_DT >= '01-jul-2009'
                                         ) aa,
                                         (          -- finds best encounter_no (i.e. smallest time diff)
                                         SELECT     RV.PP_SEQU, MIN(ABS(RV.DISCHARGE_DT - IL.CLINIBASE_ADMIT_DT)) AS ENCOUNTER_NO_score
                                        FROM        hsa_tgt.REDIS_VISITS rv,
                                                    inpatient_linker il
                                        WHERE       RV.PHN = IL.PHN
                                                AND RV.PT_GENDER = IL.GENDER
                                                AND RV.PT_DOB = IL.BIRTH_DT
                                                AND RV.DISCHARGE_DT BETWEEN IL.CLINIBASE_ADMIT_DT - 12/24 AND IL.CLINIBASE_ADMIT_DT + 12/24
                                                AND RV.DISCHARGE_DT >= '01-jul-2009'
                                        GROUP BY    RV.PP_SEQU 
                                        ) bb,
                                        (           -- finds best pp_sequ (i.e. smallest time diff)
                                        SELECT      IL.ENCOUNTER_NO, MIN(ABS(RV.DISCHARGE_DT - IL.CLINIBASE_ADMIT_DT)) AS PP_SEQU_score
                                        FROM        hsa_tgt.REDIS_VISITS rv,
                                                    inpatient_linker il
                                        WHERE       RV.PHN = IL.PHN
                                                AND RV.PT_GENDER = IL.GENDER
                                                AND RV.PT_DOB = IL.BIRTH_DT
                                                AND RV.DISCHARGE_DT BETWEEN IL.CLINIBASE_ADMIT_DT - 12/24 AND IL.CLINIBASE_ADMIT_DT + 12/24
                                                AND RV.DISCHARGE_DT >= '01-jul-2009'
                                        GROUP BY    IL.ENCOUNTER_NO 
                                        ) cc
                            WHERE       aa.PP_SEQU = bb.PP_SEQU
                                    AND aa.ENCOUNTER_NO = cc.ENCOUNTER_NO
                                    AND aa.score = bb.ENCOUNTER_NO_score
                                    AND aa.score = cc.PP_SEQU_score
                            ) dd
                WHERE       IL.ENCOUNTER_NO = dd.ENCOUNTER_NO 
                )                        
    WHERE       IL.PP_SEQU IS NULL
    ;
    Published by: user11785497 on August 12, 2009 09:05

    Hello

    user11785497 wrote:
    The rewrite to update with the sub query revised and shortened the period of one day (162 records returned).
    Under query takes to run... 46msecs update... takes forever... must be missing something simple.

    I think you're right.

    It is without doubt make the subquery again and again and throw everything except a row of results every time.
    Rewrite the update as a MERGER.

  • For the purchase of query tables

    Helloo

    What are the names of table for the fields of purchase please

    Responsibility-purchase-purchase orders

    1. the amount

    2. ship - to

    3 status

    Responsibility-purchase-purchase orders

    4 category

    Divided into category group and class



    5 closure status


    Navigation - Summary of purchase PURCHASING order-

    What table to find the following for purchase orders?

    6 Cancellation Date

    7 cancellation reason

    In the PO_LINE_LOCATIONS_ALL where I can find the next field?


    8. remaining quantity



    Thank you


    See query below that can help you. I use query on rcv_transactions to see what was received in a first time, but has not yet received in the second stage. You can also consult the lines of distribution to see how much has been ordered and delivered, but know that you can have several distributions for each line...

    SELECT P.Segment1 PO_Number
    , P.Closed_Code
    , P.Cancel_Flag
    , LOC. Location_Code
    , L.Line_Num
    , L.Quantity * L.Unit_Price amount
    , Category Cat.Concatenated_Segments
    , CAT. Category_Group Segment1
    , CAT. Category_Class Segment2
    , L.Cancel_Flag
    , L.Cancel_Date
    , L.Cancel_Reason

    , (

    SELECT Sum (DECODE (T.Transaction_Type, 'RECEIVE', T.Quantity * T.Primary_Quantity, 'RETURN to RECEIVING', T.Quantity * T.Primary_Quantity,-T.Quantity * T.Primary_Quantity))

    OF rcv_transactions T

    WHERE T.PO_Line_Location_Id = PL. Line_Location_Id

    ) Qty_To_Be_Delivered

    SAY. Quantity_Ordered

    SAY. Quantity_Delivered

    OF PO_HEADERS_ALL P

    , PO_LINES_ALL L
    , LOC HR_LOCATIONS
    , mtl_categories_kfv cat
    , PO_LINE_LOCATIONS_ALL PL
    , PO_DISTRIBUTIONS_ALL SAID
    WHERE P.Segment1 '2564686' =
    AND P.PO_Header_Id = L.PO_header_Id
    AND L.Category_Id = the cat. Stuff
    AND P.Ship_To_Location_id = LOC. location_id
    AND L.PO_Line_Id = PL. PO_Line_Id
    AND L.PO_Line_Id = TELL. PO_Line_Id

    ;

  • Help with sql query / a subquery to perform the COUNT

    Hello everyone,

    Co-worker colleague asked me to post a request here in hopes of getting more support.  Here's the question:

    There are 3 tables associated with this request.  A table of the application, which displays a number of application open for a particular request, an audit table that shows you all employees who worked on this application and one employee who shows you the details of the employee table.  My colleague is trying to understand what, how to see only applications that have been published by a wizard, but not a Manager.  There are a few applications that worked on both, but he won't see this request in its results.

    Here are the tables

    EMP

    ID FULL_NAME
    1234John Doe
    5467Jane Doe
    2345Clark Kent
    5432June Cleaver

    Unfortunately, this table does not have a title column (which was created provider, so we cannot change the internal structure).  My colleague knows who is the Assistant and the Director, then in this case, the first two of the id:

    1234 and 5467 are managers and the other 2 are assistants

    T_APPLICATION

    app_id app_number date_opened app_type
    901854778JANUARY 10, 2014NETWORK
    901954779JANUARY 11, 2014DATABASE
    901055000MARCH 12, 2014MATERIAL

    T_APP_AUDIT

    APP_ID PROCESSED_BY
    90181234
    90182345
    90185432
    90192345
    90195432
    90105432

    So, here is the actual query, I was given: it is actually to check the number of times that each application has been published per person:

    Select a.app_id, c.full_name, count (*) that controls

    t_application a, t_app_audit b, c of the emp

    where a.app_id = b.app_id and b.processed_by = c.id and

    a.app_type in ('NETWORK', "DATABASE")

    and b.processed not in ('1234, ' 5467')

    GROUP OF A.APP_ID, c.full_name;

    IF I won't see 9018 in my results, since at one time it was edited by a Manager (1234).  Unfortunately, this request does not eliminate the app_id 9018, it eliminates only the name of handlers appear in the query.  I hope I've explained this properly, and any help to point us in the right direction is welcomed.  Thanks in advance.

    Select

    a.app_id

    c.full_name

    , count (*) as the controls

    of t_application one

    t_app_audit b

    c of the emp

    where a.app_id = b.app_id

    and b.processed_by = c.id

    and a.app_type in ('NETWORK', "DATABASE")

    and b.app_id by (not in

    Select app_id

    of t_app_audit

    where processed_by in ('1234, ' 5467')

    )

    GROUP OF A.APP_ID, c.full_name;

  • Small set of record in a query table.

    Hello

    11.2.0.2 I have a table with about 2milions for registration.

    I use a query that like:

    Select *.

    DOC

    WHERE INDENTIF = 1001 AND TRASF = 0;

    to identify the new record in the table (TRASF = 0).

    INDENTIF column contains 5 separate key and TRASF can be 0,1,2

    SELECT COUNT (*), INDENTIF , TRASF

    DE DOC

    BY INDENTIF, TRASF

    VAT REGISTRATION TRASF COUNTY

    9-1004-2

    1359-1005-1

    1-1001-2

    306859 1004 1

    767090-1002-1

    2 1002 2

    782981-1001-1

    There is an index on INDENTIF TRASF but oracle uses full scan.

    His stats are available.

    Whenever I check again record he also carried out a comprehensive analysis

    If there is no new record.

    Is there a method to use an index without suspicion of use?

    Thank you

    so we see that the CBO expects 929K (= K/2 1858) for values <> 1. I guess you would get the same cardinality for transfer = 42...

    To correct the optimizers believes that there are a few options:

    1. you can create a histogram with estimate_percent = 100: this should show the CBO that there is a value other than 1 in the data-, and this non-popular value (2) corrects the estimate for all other values.

    2. you could manually create a histogram and give it to the CBO by use of dbms_stats.set_column_stats

    3. you can create a function based only including values index <> 1

    Savvinov of Nicolay has written something about it in http://savvinov.com/2012/05/23/histograms-for-strongly-skewed-columns/ (with links to items by Randolf Geist and Jonathan Lewis)

  • Loading of an oracle table empty that has recursive relationship - ETL

    Hi, I have an empty table, called programs. The columns are Short_Name, Long_Name, Pgm_ID (PK), PArent_Pgm_ID (FK). The parent_Pgm_ID and the Pgm_ID are recursive relationship. I have 3 lines, I am loading.

    1, abc, one, 25
    2, def, d, 35
    3, efg, e, 12

    I am struck by the constraint violation. I 25, 35, 12 Pgm_ID is loaded first inorder to charge the three lines above. My problem is that they might have different from Parent_Pgm_ID, should I continue to ride all the way, until all the records are synchronized.

    Can you please suggest me any solution on how to manage this ETL?

    Thanks for your time and your help.

    >
    Hi, I have an empty table, called programs. The columns are Short_Name, Long_Name, Pgm_ID (PK), PArent_Pgm_ID (FK). The parent_Pgm_ID and the Pgm_ID are recursive relationship. I have 3 lines, I am loading.

    1, abc, one, 25
    2, def, d, 35
    3, efg, e, 12

    I am struck by the constraint violation. I 25, 35, 12 Pgm_ID is loaded first inorder to charge the three lines above. My problem is that they might have different from Parent_Pgm_ID, should I continue to ride all the way, until all the records are synchronized.

    Can you please suggest me any solution on how to manage this ETL?
    >
    You cannot load a line with a 'parent' pointing 'id = 25' if there is no line in the table with 'id = 25'.

    Disable the constraint.

    Load the data.

    Select the constraint.

  • How to join this per_rating_levels this table with query table.

    Dear all,

    Guide how 2 join me per_rating_levels this table with query because, I want 2 see the per_rating_levels.name against all employees.
    When I join this table with query it shows several recording/cortion against this record.

    Query:

    SELECT
    PAPF.full_name employee_name,
    papf1.full_name supervisor_name,
    WOMEN'S WEAR. Employee_number,

    hr_general.decode_job (PAAF.job_id) job_name,
    Department of hr_general.decode_organization (PAAF.organization_id),
    PC.Name, PCE.Comments EmployeeComments,
    (by selecting pce1.comments in per_competence_elements pce1
    where
    PCE.assessment_id = pce1.assessment_id
    AND pce.competence_id = pce1.competence_id
    AND pce1.object_id = pce.object_id) ManagerComments;

    --(sélectionnez rtl.name dans rtl où les pc.) RATING_SCALE_ID = rtl. Name RATING_SCALE_ID)


    OF per_all_people_f women's wear.
    per_all_people_f papf1,
    per_all_assignments_f ADP,
    PA per_appraisals,
    pat per_appraisal_templates,
    per_assessments not,
    per_competence_elements pce,
    per_competences pc


    WHERE papf.person_id = paaf.person_id
    AND paaf.supervisor_id = papf1.person_id
    AND paaf.primary_flag = 'Y '.
    AND pa.appraisee_person_id = papf.person_id
    AND pa.appraisal_template_id = pat.appraisal_template_id
    AND pa.appraisal_id = pas.appraisal_id
    AND pat.assessment_type_id = pas.assessment_type_id
    AND pas.assessment_id = pce.assessment_id
    AND pce.object_id = papf.person_id
    AND pce.competence_id = pc.competence_id
    AND trunc (sysdate) BETWEEN papf.effective_start_date AND papf.effective_end_date
    AND trunc (sysdate) BETWEEN papf1.effective_start_date AND papf1.effective_end_date
    AND trunc (sysdate) BETWEEN paaf.effective_start_date AND paaf.effective_end_date

    - AND papf.employee_number =: p_employee_number
    - AND pa.appraisal_date =: p_appraisal_date
    - AND papf.business_group_id =: p_bg_id

    order of papf.employee_number


    Concerning

    user10941925 wrote:
    Dear all,

    Guide how 2 join me per_rating_levels this table with query because, I want 2 see the per_rating_levels.name against all employees.
    When I join this table with query it shows several recording/cortion against this record.

    '2' in your question means "to"? If so please do not use text instant message in this forum.

    Now I suppose that PRE_RATING_LEVELS is a table in your application. And you are trying to include this table in an existing query. But in doing so, you have found the Cartesian product, correct?

    In fact, how do you think someone a public forum without any knowledge of your table and data structure could help you?

    Lets see, here's your query. I formatted.

    
    select papf.full_name                                       employee_name
         , papf1.full_name                                      supervisor_name
         , papf.employee_number                                 employee_number
         , hr_general.decode_job(paaf.job_id)                   job_name
         , hr_general.decode_organization(paaf.organization_id) department
         , pc.name                                              name
         , pce.comments                                         employeecomments
         , (
              select pce1.comments
                from per_competence_elements pce1
               where pce.assessment_id = pce1.assessment_id
                 and pce.competence_id = pce1.competence_id
                 and pce1.object_id = pce.object_id
           )                                                    managercomments
      from per_all_people_f        papf
         , per_all_people_f        papf1
         , per_all_assignments_f   paaf
         , per_appraisals          pa
         , per_appraisal_templates pat
         , per_assessments         pas
         , per_competence_elements pce
         , per_competences         pc
     where papf.person_id           = paaf.person_id
       and paaf.supervisor_id       = papf1.person_id
       and paaf.primary_flag        = 'Y'
       and pa.appraisee_person_id   = papf.person_id
       and pa.appraisal_template_id = pat.appraisal_template_id
       and pa.appraisal_id          = pas.appraisal_id
       and pat.assessment_type_id   = pas.assessment_type_id
       and pas.assessment_id        = pce.assessment_id
       and pce.object_id            = papf.person_id
       and pce.competence_id        = pc.competence_id
       and trunc(sysdate) between papf.effective_start_date  and papf.effective_end_date
       and trunc(sysdate) between papf1.effective_start_date and papf1.effective_end_date
       and trunc(sysdate) between paaf.effective_start_date  and paaf.effective_end_date
    order
        by papf.employee_number 
    

    Now, you want to add the PRE_RATING_LEVELS in the list so that you can use the column NAME.

    First thing you need to do is to determine the relationship between PRE_RATING_LEVELS and other tables. A relationship can be

    1. one on one
    2 one-to-many
    3. - to-several

    So when you tried to join, your state of health has resulted in 2nd or 3rd type of relationship. If you arrive with someone who knows the business and the data and find the table that could uniquely identify a line of PRE_RATING_LEVELS.

  • FRM - 41105 you cannot query the records without a registered parent record

    I have 3 blocks of data. The data control block have the document type and number if we again record (I wrote to run the query for part of detail and header), the header block will display the details of the header of the document (header Details) and block detail will show the retail part.

    But my problem is when the new instance of recording only the header block is the mark and block of retail is not asking and giving an error message (* WRF - you can't 41105 records in the query, without a registered parent record *)!

    Please help me!

    Thanks in advance,

    Yes, I returned for the header and detail tables.

Maybe you are looking for

  • IPhone 7 Earpods

    Just a quick question. The Iphone 7 Earpods are compatible with other iphones/ipads? I was wondering if anyone has tried them and if they work in the same way.

  • Impossible to read while typing in form regions

    I know how to change the color of the text, but all my forms have gray text in them and them does not affect the normal way to change the color of the text. I can barely see what I'm typing unless I click outside of the box, THEN it becomes dark gray

  • LabVIEW 2014/2015 break with my library of wrappers

    I have a lot of LabVIEW package screws saved in LV8.6 library, they almost all containing call library function node. Recently, I was working on a new program that uses these library live I have found that when you use these screws it causes LabVIEW

  • Download of Windows 10 delay

    I downloaded Windows 10 & he gave me a few options for installing the download that forced a choice of days / hours.  I would wait & need to know how to stop the scheduled time. Thank you.

  • Can we create table in RMS

    Hello I have just one request. Is it possible to create a table as an employee with several fields such as EmployeeiD, Name, age, etc... in RMS? If so then someone can show me how its done? Thank youSaket