Assistance with queries

I have three tables:

T1 with columns ID, TEXT

T2 with columns T1_ID, T3_ID

T3 with columns ID, TEXT

T2 represents the relationship of m: n between T1 and T3

I have also two sets of values N 0 - (texts - this will be the parameters of queries).

Now, I need the query as follows:

1. all T1. TEXT for which there are records in T3 with all texts in the set1 (or all records in T1, if the set is empty) and all texts in set2 will substrings of T1. TEXT

2. all T3. TEXT related to T1 records in the 1 query, but that do not belong to the set and their cardinality in the subset

Example:

T1:

1 Amy

2 Bob

3 Chris

4 Danny

T3:

1 music

2 horses

3 paint

4 sports

T2: [1.1] (Amy loves music) [1,2] (and horses) [1.4]

[2.1] [2,2] [2,3]

[3.1] [3,4]

[4.3]

Now for the set1 empty:

Q1 should return Amy, Bob, Chris, Danny

Q2 should return music with 3, 2, paint with Sports horses and 2 with 2

If the set2, however, contains "y".

T1 should return only Amy and Danny

Q2 music with 1, 1, Sports with 2 horses

If the set1 contains 'music '.

Q1: should return Amy, Bob and Chris

Q2: Horses with 2, paint with 1 and 2 sport

If the set1 contains 'Music' and 'horses '.

Q1: should only return Amy and Bob

Q2: should return painting with Sports and 1 with 1

For 'Music', 'Paint' and 'horses '.

Q1: only Bob is returned

Q2: returns nothing

For 'Paint' and 'Sports '.

No query

Could someone help me with this, please? Thanks in advance.

Thank you, stew.

I would like to know that how to use ADF.

To make another conclusion of this thread, first of all, I want to thank to all who have contributed. I'm really impressed how well developed my question and how many valuable suggestions I received.

My caveat is that I must be able to use from ADF - or to be more precise of ViewObject, which proved not to be is not so easy - for example, check https://tompeez.wordpress.com/2011/08/21/extending-viewcriteria-to-use-sql-contains-4/ on how to use CONTAINS.

I even tried to pass all of the work of a SQL function via

Select * from table (return_table (params));

(see more in the poll a "table" of a PL/SQL function), but I didn't know what to call it either.

As I also need end up at some point, I have finally decided to redefine the scope - the set_2 has become a unique value (it contains '%', if the HashSet Java class is empty), and I used ' ~' string for set_1 separated

My final queries look like as follows:

1ST QUARTER

with the_count_table as (select 1 + regexp_count (: tags_set, ' ~') the_count where double: tags_set is not null union all select 0 the_count where double: tags_set is null), the_set_table as (select text from (select regexp_substr (: tags_set:)))  (',' [^ ~] +', 1, level) text of the_count_table, where the_count > connection by level <= regexp_count(:tags_set="" ||="" '~',="" '~'))="" union="" all="" select="" text="" from="" tags,="" the_count_table="" where="" the_count="0)" select="" sr.request_date,="" sr.problem_description,="" sr.status,="" sr.svr_id,="" the_count="" from="" service_requests="" sr,="" taglinks="" tl,="" tags="" t,="" the_count_table="" where="" sr.svr_id="tl.svr_id" and="" tl.tag_id="t.id" and="" the_count="">0 0 and lower (sr.problem_description) as lower(:substring_set) and t.text in Group (select text the_set_table) sr.request_date, sr.problem_description, sr.status, sr.svr_id, the_count having count (t.text) = the_count union all select distinct sr.request_date, sr.problem_description, sr.status, sr.svr_id, service_requests sr outer join taglinks the_count left tl on sr.svr_id = tl.svr_id outer join left tags t on tl.tag_id = t.id cross join the_count_table where the_count = 0 and lower (sr.problem_description) as lower(:substring_set)

Q2

with the_count_table as (select 1 + regexp_count (: tags_set, ' ~') the_count where double: tags_set is not null union all select 0 the_count where double: tags_set is null), the_set_table as (select text from (select regexp_substr (: tags_set:)))  (',' [^ ~] +', 1, level) text of the_count_table, where the_count > connection by level <= regexp_count(:tags_set="" ||="" '~',="" '~'))="" union="" all="" select="" text="" from="" tags,="" the_count_table="" where="" the_count="0)," the_people="" as="" (select="" sr.request_date,="" sr.problem_description,="" sr.status,="" sr.svr_id,="" the_count="" from="" service_requests="" sr,="" taglinks="" tl,="" tags="" t,="" the_count_table="" where="" sr.svr_id="tl.svr_id" and="" tl.tag_id="t.id" and="" the_count="">0 0 and lower (sr.problem_description) as lower(:substring_set) and t.text in Group (select text the_set_table) sr.request_date, sr.problem_description, sr.status, sr.svr_id, the_count having count (t.text) = the_count union all select distinct sr.request_date, sr.problem_description, sr.status, sr.svr_id, service_requests sr outer join taglinks the_count left tl on sr.svr_id = tl.svr_id outer join left tags t on tl.tag_id = t.id cross join the_count_table where the_count = 0 and lower (sr.problem_description) as lower (:substring_set)) select t.text, count (*) the use of tags t, taglinks tl, sr from service_requests where tl.tag_id = t.id and sr.svr_id = tl.svr_id and (sr.svr_id in (select svr_id from the_people) and (: tags_set is null or (t.text not to (select text the_set_table))) group by order t.text by using desc ))


(my actual case data model is slightly different from those used in the question)

Tags: Database

Similar Questions

  • How can I get assistance with my Apple Care Protection Plan when I am abroad

    How can I get assistance with my Apple Care Protection Plan when im abroad?

    I brought an iPhone 6Plus in Europe and now I am traveling

    I would like to know if Apple Care Protection Plan cover me in the United States and what I can do

    Hey there, Aleji!

    Based on your post, I understand you have a few questions about your AppleCare protection + plan, and where coverage is available.

    You can get more information on your cover in the next article.

    About your coverage options and support services

    Additional information about the warranty is also available on the link below. Simply select your device and the region.

    The hardware guarantee

    Have a great day!

  • I need assistance with Outlook Express

    I need assistance with my outlook express. Please

    See www.oehelp.com/OETips.aspx#7 or be more specific, and perhaps we can help you.

    Steve

  • I NEED ASSISTANCE WITH MY ETHERNET DRIVER. HOW CAN I GET THIS TO WORK NEW TI?

    Original title: driver ethernet

    I NEED ASSISTANCE WITH MY ETHERNET DRIVER.  HOW CAN I GET THIS TO WORK NEW TI

    Download and install it

    The driver should be available in the manufacture of computers site

    Use the snid on a label on the computer to search with while you're there

    Or if the motherboard came with a disc to load and the reader will be on it.

  • I could not find download Windows Mobile Device Center 6.1 so I can download pic & videos from my phone to my computer. I need assistance with their phone is off and on computer any ideas please help.

    I could not find download Windows Mobile Device Center 6.1 so I can download pic & videos from my phone to my computer. I need assistance with their phone is off and on computer any ideas please help.

    See http://support.microsoft.com/kb/931937

  • I need assistance with combine jpeg and raw photo even after import [was: Hello?]

    I need assistance with combine jpeg and raw photo even after importation

    You mean both JPG and RAW file after importing from a camera memory card? There is a setting in LR preferences to process the JPG images next to RAW files as separate photos. It is under the general tab of preferences. By default, this option is not checked.

    If this is not your problem, then we will need Lots and Lots and lots more information about what you mean by the combine

  • I need assistance with deactivation Suite CS6.  My Mac Book has been stolen. Can you help me?

    I need assistance with deactivation Suite CS6.  My Mac Book has been stolen. Can you help me?

    Contact support by web chat or telephone to reset the activations.

    Mylenium

  • I need assistance with lightroom 4 - I downloaded the software but I can not access

    I need assistance with lightroom 4 - I downloaded the software but I can't access it. I have windows XP I need to upgrade to windows vista or windows 7? Any help please. Thanks Zara

    Lightroom 4 does not work on Windows XP

    http://www.Adobe.com/products/Photoshop-Lightroom/tech-specs.html

    You will need to upgrade to Windows 7 or Windows 8. Avoid Vista - It's terrible.

  • Using Migration Assistant with no display

    I got my MacBook mid-2010 (2.4 GHz, 4 GB RAM, OS X El Capitan) for 2 years.

    It splits into two somewhere within 2 years.

    The MacBook was still usable, but it had to be on a desk. The screen was completely separate from the base. It still worked.

    I woke up a few days ago to find that someone had cut the display cable holding the MacBook set and turn on the screen.

    I bought an early-2011 13 "MacBook Pro to replace the dead MacBook. (Yes, I buy old Mac because the news is so expensive).

    Old Mac has been saved semi regularly, so I have an old backup to use for the new Mac. The problem is that just before the death of the former Mac, I downloaded a bunch of stuff that has not been saved. I really want the files that have not been backed up on my new MBP.

    Can I use Migration Wizard with an Ethernet cable and transfer of data from one, or Migration Assistant must be running on old Mac as well?

    I tried to connect (I'm sure that the computer is still running, it doesn't simply have a display) on the old Mac, plug the backup drive and I hope to do a backup hourly, but Time Machine did not only.

    Any suggestions would be GREATLY appreciated.

    If you use Ethernet or a wireless network to transfer data, Yes. If you can not download the files and file-sharing has not been activated on the old Mac, you must either get fixed display or put its internal drive in a closed Chamber.

    (143074)

  • Satellite A300D - 156 BIOS update failed - I need assistance with recovery

    Hello

    I know it is old enough, but until now, it was just good enough for my use.
    In any case, after I did a restore of the Windows Vista operating system came with my computer, I got a notification of one of the tools of Toshiba that an updated BIOS is available for my computer.
    I downloaded and tried to perform an update. After that the process had finished (probably), the computer has not responded to the pad touchscreen and keyboard. I was not sure if the update really took place, especially because it looked like the computer has been is frozen. So I left it for the next +/-30 minutes, but no change.
    So I decided to reset it as even the power button did not work. So I had to remove the battery and unplug the AC power.

    ... and the computer has (almost) dead then.

    Now, it is that when I press the power button it seems to power up but the screen remains blank, fan works and Windows is not booting. It's just a short scratching sound of the DVD drive noise, and that's all.

    My question is, what is the recovery procedure in my situation? I tried to look for potential assistance on the Internet and I found a few forum or articles messages indicating that there is some recovery for the different BIOS procedures, but what is the procedure for my BIOS? The only thing I found the 'work' was that if I press the power button now the keys Fn + Esc, computer laptop powers on with power button / stop flashes. But how to force recovery BIOS flashing procedure?

    Thanks in advance for any help!

    It's really stupid situation now. You will not be able to fix it with a simple recovery operation. BIOS is broken.
    In the past I have faced no such situation but on this forum I found a very interesting thread on BIOS recovery. Please take some time and visit this thread.

    Maybe this will help you with your machine.

  • I NEED ASSISTANCE WITH MY APPLE FOR MY ICLOUD COORDINATION ID ID

    I got a new iPhone5, and in some sort the iCloud username was set to an old my friends e-mail account that is different from my current ID. Apple ICloud I sign again, but I do not know the password.  I tried to reset the password with the old email address, but the site reset does not have the username that I.  I am in a catch 22.    When I go to iCloud in the settings it is all grey and the iCloud drive show it's upgrading, but he never finished the upgrade.  I called the support of apple, but without success;  I went to the Apple store and they say that I need to contact apple, Apple Care support.    I have the latest ios. Any ideas on how to solve this problem?

    Welcome to the Apple community.

    If you are unable to remember your password, security issues, do not have access to your address of rescue or are unable to reset your password for any reason, your only option is to contact the Support of Apple ID, to speak to an operator you should explain that your problem is related to your Apple ID This way you can be attributed to the assistance, even if you do not have an AppleCare plan.

    You will need to be patient with the process and to be ready to prove without doubt that the account belongs to you. Do not expect access to be restored immediately and if you are not the owner of the Apple ID saved to the device the account will not be reset.

  • How to change the input range (DAQ assistant) with a digital command?

    Hello everyone

    I am currently working with the NI USB-6218 acquisition card.

    In order to acquire a signal, I would like to be able to choose the input range of the DAQ with a digital command Wizard (and not opening the window of DAQ assistant) (as 'number of sample' and section 'rate'...)

    Is this possible and if so, how?

    Thank you very much in advance for your answers!

    You can't with the DAQ Assistant so just click on and select "generate the Code of OR-DAQmx. You can edit the Subvi who performs the installation.

  • I need assistance with LabVIEW RT and dll

    Hello!

    I'm new to LabVIEW but I am facing something very difficult.

    I develop with LabVIEW 2012 on a cRIO-9082, and I would use a specific DLL in a VI. The DLL is called TcAdsDll.dll and it is used to communicate with a PLC. (This DLL is provided by Beckhoff, for more information: http://infosys.beckhoff.com/index_en.htm TwinCAT > TwinCAT system > TwinCAT connectivity > TwinCAT ADS).

    When I use the 'library of the call' function with the DLL, I get an error 7. I'm just trying to call a simple function of the DLL.

    I know that in LabVIEW RT (Pharlab) only certain DLLs are supported. I also checked the DLL with the tool of NEITHER, but after the 10th dependend DLL calling it just hangs.

    If someone is able to provide assistance, I would be very grateful!

    Does anyone know, what are the rules for the dll must be met to use in LabVIEW RT?

    Thanks in advance!

    A DLL must call only Win32 API supported by the Pharlap ETS system in question in the first place. Since NO guard updated the ETS with almost every new version of LabVIEW it depends actually. DLL checking tool is the only way I know to check this. If this DLL checking failures, or as in your case tool breaks down, the DLL is not justifiable on the RT system. The Beckhoff ADS DLL is a complex beast with many dependencies on any other DLLs Beckhoff and what else, and as such a bad candidate to run on NI RT systems.

    In addition to this fundamental questions, you have additional problems with the Microsoft c runtime library in his infinite wisdom, has decided to create a new C runtime library version with each new version of Visual C. It is already a problem for a developer when deploying to standard PC Windows, but gets a problem almost unmanagabel when targeting something as Pharlap ETS. NEITHER seems to have paid the MS C runtime for their version of the toolchain Visual C of choice for LabVIEW RT system, but this isn't an option for you. If the 3rd party DLL to be used has been compiled in a version of Visual different C that ANYTHING used for the RT version you want to use, then you almost certainly run into trouble, unless the DLL was created with Visual C 6.0 (now a very old version)!

    I've created in the past as a VI based entirely the LabVIEW ADS communication library. It is a tedious job to know the actual byte stream protocol. Unfortunately it is not something that I can share with the community.

    Your best bet would probably be to use the cRIO Ethercat solution and go with an Ethercat on your PLC interface. EtherCAT is sort of a superset of the ADS interface.

    Maybe you can also talk with these guys here. They have a few ADS LabVIEW library and Ethercat libraries too. Not sure if they are basic DLLS and if they would be compatible with LabVIEW RT well.

  • Using DAQ Assistant with a system remotely

    I'm new to LabVIEW and National Instruments hardware and I am trying to use an instrument with LabVIEW using the DAQ Assistant. I use a PC with Windows Vista and I am connected via a network to a PXI-8108 controller in a PXI-1050 chasiss chassis. The instrument is just a thermocouple which I use to become familiar with everything. The thermocouple is connected and the connection SCB-68 block which is connected to a PXI-6221 multifunction data acquisition in the chassis. I am able to create a task in MAX under remote system and everything seems to work. What I want to do is to use this instrument in LabVIEW, and it seems that for this I need to use the DAQ Assistant, but when I do it says no supported device is found. I wonder if there is a way to get LabVIEW lean on the remote system to see the acquisition of data and the thermocouple.

    All advice is appreciated.

    Thank you

    Hi all

    Ben is correct.  RDA is no longer supported in DAQmx.  We have another way to use DAQmx with a remote system.  It is use DAQmx with an OPC server or simply by shared network variables.  There is a section of the base of knowledge here that should help you get started.  You should also take a look at the developer section area here.  The basic idea is that you can use a variable shared within labVIEW that is bound to a variable shared on your networked machine.  In this way, you can write and read values from a task DAQmx.  Look at the instructions in the above two items and let me know if you have any questions.

    Kind regards

    Paul C.

  • I need assistance with an ICS connection

    I have a laptop and my friend has a desktop computer. I tried to set up an Entrepreneur with my laptop being the host pick up a wireless signal and desktop connected with a network cable. I followed the help and put evrything correctly to allow ISC and as a first step, the Office recorded internet connection. but when my friend tried to open internet explorer, he said it was a problem and he couldn't dignose it. After trying and after assistance that the office is still connected to the network, the laptop has internet sharing on, but no internet signal is received by the office. I've been through the help of a dozen times. Allow internet sharing is enabled, the options of the internet on both computers are set (help supposed to check never dial a connection and uncheck everything in the LAN settings) and iv configured TCP/IP connections. I know it's very long (sorry!), but any help would be greatly appreciated! Thanks in advance!

    I have no knowledge on ICS... No.

    But I have 2 links here in my library. See if they can help you.

    Step by step Internet Connection Sharing (ICS)
    http://www.windowsreference.com/Windows-Vista/step-by-step-Internet-Connection-Sharing-ICS-Setup-in-Vista/

    Internet connection sharing
    http://www.home-network-help.com/Internet-connection-sharing.html . for the benefits of others looking for answers, please mark as answer suggestion if it solves your problem.

Maybe you are looking for

  • PC (Windows 10) recognize iPhone 4s, but iTunes does not work

    Hey guys, I have an iPhone 4S located on 7.1.2. She sees perfectly well and my PC (Windows 10) recognizes the iPhone and can even access photos folder if the phone is unlocked. However whenever I plug my phone into my PC it prompts you to trust this

  • BBC iPlayer ATV4 - you can download programs?

    Can you download programs on the ATV4 using the BBC iPlayer app? I gave up using Airplay on my ATV3 long ago and now connect my Mac HDMI because it is much more stable and the quality is exceptional. But I don't like streaming and prefer to download

  • What is the right way to recharge the iphone 6

    What is the right way to recharge the iphone 6?

  • I don't get emails on my bb 8820 phones smart blackBerry

    All of a sudden i ' n not getting emails, I tried syncing with the line manager and tried to reload the disc, I tried the e-mail settings, but that won't let me enter any text. It keeps saying "he does not know his message accont address or it is not

  • HP 210-2004sa error

    I have a HP 210-2004, but it seems that it cannot go on windows 7. When I open it. The first wizard of time started to came out. and when the wizard was finished., error box came out. and he said: 'we found an inconsistency in your configuration data