Query to only reach the one-to-one relationship data

Hello

I am looking for a query search lines with one-to-one relation ship.
To keep it simple here is the code example.
CREATE TABLE my_storegroup_gbcust
(
  store_grp_id        NUMBER(6)                 NOT NULL,
  group_buy_cust_num  NUMBER(5)                 NOT NULL
);

INSERT INTO my_storegroup_gbcust (store_grp_id, group_buy_cust_num ) VALUES (1002, 70001);
INSERT INTO my_storegroup_gbcust (store_grp_id, group_buy_cust_num ) VALUES (1003, 70001);
INSERT INTO my_storegroup_gbcust (store_grp_id, group_buy_cust_num ) VALUES (1004, 70001);
INSERT INTO my_storegroup_gbcust (store_grp_id, group_buy_cust_num ) VALUES (1005, 70001);
INSERT INTO my_storegroup_gbcust (store_grp_id, group_buy_cust_num ) VALUES (1006, 70001);
INSERT INTO my_storegroup_gbcust (store_grp_id, group_buy_cust_num ) VALUES (2001, 65000);
INSERT INTO my_storegroup_gbcust (store_grp_id, group_buy_cust_num ) VALUES (28001, 21800);
INSERT INTO my_storegroup_gbcust (store_grp_id, group_buy_cust_num ) VALUES (35001, 27010);
INSERT INTO my_storegroup_gbcust (store_grp_id, group_buy_cust_num ) VALUES (35001, 37927);

select * from MY_STOREGROUP_GBCUST

STORE_GRP_ID     GROUP_BUY_CUST_NUM
------------     ------------------
1002               70001
1003               70001
1004               70001
1005               70001
1006               70001
-----------------------------
2001               65000
-----------------------------
28001               21800
-----------------------------
35001               27010
35001               37927
The data in the table describe 3 types of relationships.
Many-to-one = > several groups to buy a group of stores = > example: 1002,1003,1004,1005,1006 mapped to 7001
One-to-one = > Group a store to buy a group only = > example: 2001 mapped to 65000. 28001 mapped to 21800
One-to-many = > store group in many group buy = > example: 35001 mapped to 27010,37927

I am now able to achieve through one-to-many and many-to-one query per as below:
select group_buy_cust_num,count(*) from MY_STOREGROUP_GBCUST group by group_buy_cust_num having count(*) > 1
select store_grp_id,count(*) from MY_STOREGROUP_GBCUST group by store_grp_id having count(*) > 1    
But how do individual exclusively.

Thank you
Raj.

Hello

A way

select      store_grp_id
     , group_buy_cust_num
     , case when x = 1
          then case when y = 1
                    then 'One to One'
               else 'One to Many'
               end
          else 'Many to one'
          end z
from (
     select store_grp_id
          , group_buy_cust_num
          , count(*) over (partition by store_grp_id order by null) x
          , count(*) over (partition by group_buy_cust_num order by null) y
     from my_storegroup_gbcust
)

Concerning
Anurag Tibrewal

Tags: Database

Similar Questions

  • Reading loop DAQmx only reaches the speed of Communication series

    Hello everyone,

    This is my first post in this Forum. I have a program with 4 loops, 2 separate and 2 connected by a queue. The first loop (see attachment loop PID) runs at maximum speed, the second a (serial communication) works at maximum speed (very slow because of the speed of series).

    To find the error I deleted from the queue to get 4 separate loops. The loop with the calculations (calculate loop) now also runs at the maximum speed, but the analog read loop just past the loop of serial communication speed. On the inside of the Sub - VI is just the configuration for the DAQmx with internal sampling. I have no connection between the loop of serial communication and analog playback loop. Is it possible that the DAQmx is slowed down because of the serial communication? Serial communication also uses a windows DLL.

    I hope you can help me.

    Best regards

    Jannik

    Thank you for your quick response. I found the answer, I guess that: I deleted the Subvi and the use of the DAQmx in the loop directly, it has worked. I think that the Subvi took too long because of the additional options to run at 1 kHz.

  • LifeLog only show the past 3 months of data.

    My Lifelog is only show my data in the last three months. Can someone please?

    Thank you very much.

  • Only one virtual host can reach the door at the same time?

    I installed ESXi 6 on a HP ProLiant DL380p Gen8 and got an operational virtual host. But it seems that no matter what I do, one host can reach the door at one point. All other grandis hosts can ping other virtual hosts and ESXi hardware, but can not get any further than that. And the same is true of outside: I can reach ESXi and a host of outside this subnet, but others are inaccessible.

    I checked that each host is configured correctly and in the same way, and they have different MAC addresses and is even went up to clone a virtual machine that has access to the network, without success.

    The upstream network hardware is not under my control, but they swear everything that should be the cause of this behavior. The ProLiant server has a Broadcom NetXtreme BCM5719, 1Gbps full-duplex. The guests are CentOS 7 x 64, with adapters vmxnet3 (but Intel E1000 adapters exhibit the same behavior). All hosts are on the same port group.

    Any ideas?

    Welcome to the community,

    It sounds as if the physical switch port is secure port, which generally limits the number of MAC addresses that are allowed to 2. Depending on the switch model, this may be named "desktop" mode. Change mode of the configuration of the port to access (or trunk) should solve the problem.

    André

  • iMac vesa support 5 k only from the factory? Or I can buy one?

    I have an iMac 5 k, and I would like to know if I can by a Vesa Mount for her, or she just factory?

    Only from the factory. However, you could buy one from here: http://www.imacmount.com

  • My screen iphone6 is cracked and in my country, they can only change the iphone with a new one and with a very high price. Is there anyway that I could replace just the screen?

    My screen iphone6 is cracked and in my country, they can only change the iphone with a new one and with a very high price. Is there anyway that I could replace just the screen?

    No, if you want to keep all rights to the service or support from Apple. Not to mention the fact that it then will be bork Touch ID and make the phone unusable if ever, you restore or update of iOS.

    Apple doesn't sell parts of the iPhone. There is no legitimate sources for replacement screens.

  • The z570 has not a regular Express card slot (only a mini one)?

    The z570 has not a regular Express card slot (only a mini one)?

    Hi KiteEye and welcome to the community,

    It doesn't have an Express card slot.

    The small slot located is a memory card reader.

    Dave

  • I want to keep my cookies, they are something, I'll share with only the one who gave it to me, no one else could even not that I have.

    Well thank you for clicking on my question curiously titled! Now, I want to block access to cookies. I do not want to block cookies, they are useful. Example; ABC let me a cookie, I'm on Zxy which can then read cookie Abc. That's what I want to stop. I don't want a site that does not allow the cookie to be able to see the cookie. I want to keep my cookies, they are something, I'll share with only the one who gave it to me, no one else could even not that I have. I tell myself that there must be a way to do this with Windows, I mean after all it allows read/write access.

    P. S.

    I like the fact that I can write on a cookies this way.

    Hello

    Thank you for your response. I appreciate your time.

    I suggest you refer to the Chrome support the link mentioned below:

    Google Chrome help

    Sincerely,

    Ankit Rajput

  • VPN Cisco ASA 5540 L2L - one-way traffic only for the pair to a network

    Hello

    I'm a little confused as to which is the problem. This is the premise for the problem I have face.

    One of our big clients has a Cisco ASA5540 (8.2 (2)) failover (active / standby). Early last year, we have configured a VPN from Lan to Lan to a 3rd party site (a device of control point on their end). He worked until early this week when suddenly the connection problems.

    Only 1 of the 3 networks the / guests can access a remote network on the other side. 2 others have suddenly stopped working. We do not know of any change on our side and the remote end also insists that their end configurations are correct (and what information they sent me it seems to be correct)

    So essentially the encryption field is configured as follows:

    access-list line 1 permit extended ip 10.238.57.21 host 10.82.0.202 (hitcnt = 2)
    access-list line 2 extended permit ip 10.207.0.0 255.255.0.0 10.82.0.200 255.255.255.252 (hitcnt = 198)
    access-list line 3 extended permit ip 10.231.191.0 255.255.255.0 10.82.0.200 255.255.255.252 (hitcnt = 173)

    Free NAT has been configured as follows (names modified interfaces):

    NAT (interface1) 0-list of access to the INTERIOR-VPN-SHEEP

    the INTERIOR-VPN-SHEEP line 1 permit access list extended ip 10.231.191.0 255.255.255.0 10.82.0.200 255.255.255.252
    permit for Access-list SHEEP-VPN-INSIDE line lengthened 2 ip host 10.238.57.21 10.82.0.202

    NAT (interface2) 0-list of access VPN-SHEEP

    VPN-SHEEP line 1 permit access list extended ip 10.207.0.0 255.255.0.0 10.82.0.200 255.255.255.252

    After the problem started only 10.207.0.0/16 network connections worked for the site remote 10.82.0.200/30. All other connections do not work.

    There has been no change made on our side and on the side remote also insists there has been no change. I also checked how long the ASAs have been upward and how long the same device has been active in the failover. Both have been at the same time (about a year)

    The main problem is that users of the 10.231.191.0/24 cant access remote network network. However, the remote user can initiate and implement the VPN on their side but usually get any return traffic. Ive also checked that the routes are configured correctly in the routers in core for the return of their connections traffic should go back to the firewall.

    Also used of "packet - trace" event raising the VPN tunnel (even if it passes the phases VPN). For my understanding "packet - trace" alone with the IP source and destination addresses must activate the VPN connection (even if it generates no traffic to the current tunnel).

    This is printing to the following command: "packet - trace entry interface1 tcp 10.231.191.100 1025 10.82.0.203 80.

    Phase: 1
    Type: ACCESS-LIST
    Subtype:
    Result: ALLOW
    Config:
    Implicit rule
    Additional information:
    MAC access list

    Phase: 2
    Type: FLOW-SEARCH
    Subtype:
    Result: ALLOW
    Config:
    Additional information:
    Not found no corresponding stream, creating a new stream

    Phase: 3
    Type:-ROUTE SEARCH
    Subtype: entry
    Result: ALLOW
    Config:
    Additional information:
    in 10.82.0.200 255.255.255.252 outside

    Phase: 4
    Type: ACCESS-LIST
    Subtype: Journal
    Result: ALLOW
    Config:
    Access-group interface interface1
    access-list extended allow ip 10.231.191.0 255.255.255.0 10.82.0.200 255.255.255.252
    Additional information:

    Phase: 5
    Type: IP-OPTIONS
    Subtype:
    Result: ALLOW
    Config:
    Additional information:

    Phase: 6
    Type: INSPECT
    Subtype: np - inspect
    Result: ALLOW
    Config:
    class-map inspection_default
    match default-inspection-traffic
    Policy-map global_policy
    class inspection_default
    inspect the http
    global service-policy global_policy
    Additional information:

    Phase: 7
    Type: FOVER
    Subtype: Eve-updated
    Result: ALLOW
    Config:
    Additional information:

    Phase: 8
    Type: NAT-FREE
    Subtype:
    Result: ALLOW
    Config:
    NAT-control
    is the intellectual property inside 10.231.191.0 255.255.255.0 outside 10.82.0.200 255.255.255.252
    Exempt from NAT
    translate_hits = 32, untranslate_hits = 35251
    Additional information:

    -Phase 9 is a static nat of the problem to another network interface. Don't know why his watch to print.

    Phase: 9
    Type: NAT
    Subtype: host-limits
    Result: ALLOW
    Config:
    static (interface1, interface3) 10.231.0.0 10.231.0.0 255.255.0.0 subnet mask
    NAT-control
    is the intellectual property inside 10.231.0.0 255.255.0.0 interface3 all
    static translation at 10.231.0.0
    translate_hits = 153954, untranslate_hits = 88
    Additional information:

    -Phase 10 seems to be the default NAT for the local network configuration when traffic is to the Internet

    Phase: 10
    Type: NAT
    Subtype:
    Result: ALLOW
    Config:
    NAT (interface1) 5 10.231.191.0 255.255.255.0
    NAT-control
    is the intellectual property inside 10.231.191.0 255.255.255.0 outside of any
    dynamic translation of hen 5 (y.y.y.y)
    translate_hits = 3048900, untranslate_hits = 77195
    Additional information:

    Phase: 11
    Type: VPN
    Subtype: encrypt
    Result: ALLOW
    Config:
    Additional information:

    Phase: 12
    Type: VPN
    Subtype: ipsec-tunnel-flow
    Result: ALLOW
    Config:
    Additional information:

    Phase: 13
    Type: IP-OPTIONS
    Subtype:
    Result: ALLOW
    Config:
    Additional information:

    Phase: 14
    Type: CREATING STREAMS
    Subtype:
    Result: ALLOW
    Config:
    Additional information:
    New workflow created with the 1047981896 id, package sent to the next module

    Result:
    input interface: interface1
    entry status: to the top
    entry-line-status: to the top
    output interface: outside
    the status of the output: to the top
    output-line-status: to the top
    Action: allow

    So, basically, the connection should properly go to connect VPN L2L but yet is not. I tried to generate customer traffic of base (with the source IP address of the client network and I see the connection on the firewall, but yet there is absolutely no encapsulated packets when I check "crypto ipsec to show his" regarding this connection VPN L2L.) Its almost as if the firewall only transfers the packets on the external interface instead of encapsulating for VPN?

    And as I said, at the same time the remote end can activate the connection between these 2 networks very well, but just won't get any traffic back to their echo ICMP messages.

    access-list extended allow ip 10.231.191.0 255.255.255.0 10.82.0.200 255.255.255.252
    local ident (addr, mask, prot, port): (10.231.191.0/255.255.255.0/0/0)
    Remote ident (addr, mask, prot, port): (10.82.0.200/255.255.255.252/0/0)
    current_peer: y.y.y.y

    #pkts program: encrypt 0, #pkts: 0, #pkts digest: 0
    #pkts decaps: 131, #pkts decrypt: 131, #pkts check: 131
    compressed #pkts: 0, unzipped #pkts: 0
    #pkts uncompressed: 0, comp #pkts failed: 0, #pkts Dang failed: 0
    success #frag before: 0, failures before #frag: 0, #fragments created: 0
    Sent #PMTUs: 0, #PMTUs rcvd: 0, reassembly: 20th century / of frgs #decapsulated: 0
    #send errors: 0, #recv errors: 0

    If it was just a routing problem it would be a simple thing to fix, but it is not because I can see the connection I have to confirm it by the router base on the firewall, but they don't just get passed on to the VPN connection.

    Could this happen due to a bug in the Software ASA? Would this be something with Checkpoint VPN device? (I have absolutely no experience with devices of control point)

    If there is any essential information that I can give, please ask.

    -Jouni

    Jouni,

    8.2.4.1 is the minimum - 8.2.4 had some issues (including TCP proxy).

    If this does not resolve the problem - I suggest open TAC box to get to the bottom of this ;-)

    Marcin

  • SQL: how to display the second string of the function in the Jobs table only if the function has more than one string.

    SQL: how to display the second string of the function in the Jobs table only if the function has more than one string.

    Hello

    You can use REGEXP_SUBSTR Oracle/PLSQL: REGEXP_SUBSTR function

    Select the function double REGEXP_SUBSTR('PUBLIC RELATION REPRESENTATIVE ','[^]+',1,2);

    Do you have any value of the column as no 2nd string?

  • Can I find out if I had to buy the Adobe Creative Suite 6 Design & Web Premium, but I subscribed to photography CC for only one month plans, can I unsubscribe it and use the one bought instead?

    Can I find out if I had to buy the Adobe Creative Suite 6 Design & Web Premium, but I subscribed to photography CC for only one month plans, can I unsubscribe it and use the one bought instead?

    I subscribed to the creative cloud only because I did not know that my College courses will be using other software too.

    I hope to unsubscribe to the creative Cloud version and use the purchased instead.

    But if it is not possible, I'll just use the CC version for this year and use the one bought on my other PC.

    Hi, NGOs,

    Yes, if you intend to use CS6, you can still use it after the cancellation of the plan of the CC photography, you can also improve your plan to plan photography to Creative Cloud applications

    If you wish to cancel your plan well photography please contact support by calling/chat for cancellation requests and billing queries:

    https://helpx.Adobe.com/contact.html?step=CCSN_membership-account-payment_cancel-your-memb ership_stillNeedHelp

    * Be sure to stay connected with your Adobe ID before accessing the link above *.

    You can also check the help below document:

    https://helpx.Adobe.com/x-productkb/policy-pricing/cancel-membership-subscription.html

    Please go through the Adobe - General conditions of subscription as well.

    He hopes to help!

    Rayyan

  • Hi I would like th different creative cloud buy 2, only photoshop/lightroom one and the other with all pack.is it is possible because I saw that we can only install on 2 different computers at the same time

    Hi I would like th different creative cloud buy 2, only photoshop/lightroom one and the other with all pack.is it is possible because I saw that we can only install on 2 different computers at the same time

    Creative desktop cloud applications can be downloaded and installed on multiple computers, regardless of the operating system. However, the activation is limited to two machines per individual related to the composition, and you may not use the software on these devices simultaneously.

    You can also see:

    FAQ: Can I install Creative Cloud on several computers?

    You can either sign of Creative cloud on a computer to connect to another, or as you said, buy a membership second using an AdobeID different so that you can leave, signed at on 4 computers.

  • I am creating a total field contingent in a PDF form created by me which will only add cost in total ONLY if the box is checked.  Another disadvantage to this is one of the fields (number of monitors), I am eager to multiply by the field notes.

    I am creating a total field contingent in a PDF form created by me which will only add cost in total ONLY if the box is checked.  Another disadvantage to this is one of the fields (number of monitors), I am eager to multiply by the field notes, which is a field required number on there.

    All of them are select___

    Here are all the names of FQDN (towards the bottom):

    Check the boxes:

    • selectiPhone
    • selectSwipe
    • selectMonitor
    • selectDesktop
    • selectLaptop
    • selectiPadCell
    • selectiPad
    • selectPhone

    Fields of costs:

    • CostiPhone
    • CostSwipe
    • CostMonitor
    • CostDesktop
    • CostLaptop
    • CostiPadCell
    • CostiPad
    • CostPhone

    The notes field that will calculate this is "NotesComputer Monitor in notes". -It is a body of numbers forced the inability to put anything else in it.

    Then add them all in TOTAL COST

    Sorry for my ignorance: it's my first time doing a form like this.

    Please see below for the screenshot.

    2015-10-12_1411.png

    Dropbox - conditionalSum.pdf has the answer

  • How to make all the fields on one page read only (for the recipient) without having to make each field read-only?

    How to make all the fields on one page read only (for the recipient) without having to make each field read-only?

    Hello Jmbtexas4,

    By default, you will need to individually click on the fields of the form and check the 'read only' and save it. From now on, it is not possible to select all together and make the changes.

    -Usman

  • I have recently upgraded my MacBook Pro and Adobe creative suite 6.0 on the former. It of maybe a stupid question, but how do I get the software on my new MacBook Pro? My understanding is that my serial number only works with one computer at a time?

    I have recently upgraded my MacBook Pro and Adobe creative suite 6.0 on the former. It of maybe a stupid question, but how do I get the software on my new MacBook Pro? My understanding is that my serial number only works with one computer at a time?

    Hello

    You can install a copy of the software on the second machine it's just you are authorized to use on one machine at a time.

    You can check: how many computers can you install or run Adobe software on? ProDesignTools

    End user FAQ license contracts

    Please visit the given link to download CS6: applications download Creative Suite 6

    Concerning

    Bianka Attre

Maybe you are looking for