Get the data with more than one of the desired value

Hello

I need to shoot the records with one value of 'Other' more on delivery days fields.
Delivery of fields are Mon, Mar, sea, game, Fri and Sam that indicates where the item will be shipped. The value can be at home, work, or other.

Examples of data include:
cust_id: 123
Article: newspaper
Mon: Home
Kill: Work
Sea: other
game: Home
Fri: other
Sam: other


And here is my request so far.
Select
cust_id,
agenda,
LUN,
Mar,
Kills,
game,
Fri,
Sam
sum (case when (del_mon = 'o' or del_tue =' o 'or del_wed =' o 'or del_thu =' o 'or del_fri =' o ' or del_sat = 'O') then 1)
otherwise 0 end) as day_ctr

of the customer

Could you please help me with the right formula should I get this?

Thank you in advance...

Hello

This should do it:

Scott@my11g SQL>with sampledata as (
  2  select 123 cust_id, 'newspaper' item, 'Home' mon, 'Work' tue, 'Other' wed, 'Home' thu, 'Other' fri, 'Other' sat from dual
  3  union all
  4  select 456, 'newspaper' item, 'Home' mon, 'Work' tue, 'Home' wed, 'Home' thu, 'Home' fri, 'Other' sat from dual
  5  )
  6  --#### True query starts here ####
  7  select *
  8  from sampledata
  9  where (
 10  decode(mon,'Other',1,0)
 11  +decode(tue,'Other',1,0)
 12  +decode(wed,'Other',1,0)
 13  +decode(thu,'Other',1,0)
 14  +decode(fri,'Other',1,0)
 15  +decode(sat,'Other',1,0)
 16  )>1 ;

   CUST_ID ITEM      MON  TUE  WED   THU  FRI   SAT
---------- --------- ---- ---- ----- ---- ----- -----
       123 newspaper Home Work Other Home Other Other

Tags: Database

Similar Questions

  • How to list all the vm with more than one network card?

    Hello

    Is it possible to only list all my s vm in my environment with more than one network card?

    I tried using the Get-NetowrkAdapter cmdlet, but could not get the desired results.

    Get - VM | Get-NetworkAdapter | Select-Object Name. ConvertTo-HTML-head $a - body "Virtual Machines < H2 > < / H2 > ' | Out-file D:\vms.htm

    Thank you

    Hello, AGFlora-

    Of course, you can do this with the standard as cmdlets:

    ## using standard cmdletsGet-VM | Select Name, @{n="NumNICs"; e={(Get-NetworkAdapter -VM $_ | Measure-Object).Count}} | ?{$_.NumNICs -gt 1}
    

    Or, if you want to get the results a little (or a lot) more quickly, you can use the cmdlet Get-view as:

    ## fast-like, using Get-ViewGet-View -ViewType VirtualMachine -Property Name,Config.Hardware.Device | Select Name,@{n="NumNICs"; e={($_.Config.Hardware.Device | ?{$_ -is [VMware.Vim.VirtualEthernetCard]} | Measure-Object).Count}} | ?{$_.NumNICs -gt 1}
    

    Those are both by selecting the names of virtual machines and their number of network cards.  Then you can direct this output to Export-Csv, ConvertTo-HTML, what you like.  What to do for you?

  • How can I associate my rt surface with more than one account of sky drive

    How can I associate my rt surface with more than one account of sky drive.

    You will need to create a new account on the computer by using the Microsoft Account associated with the other SkyDrive.

    To create a new user, open laptop settings, in the general section, click 'add a new user '.

  • When you subscribe to creative Cloud(Photoshop and Lightroom), that come with more than one license, and is it possible to install it on Windows and Apple (if it comes with two licenses)? Thank you.

    When you subscribe to creative Cloud(Photoshop and Lightroom), it does it with more than one license, and if so, is it possible to install on Windows and Apple OX? Thank you.

    A Cloud subscription provides for the installation of facilities to work on both machines.  You can have (Windows and Apple OX) operating systems.

  • Select Date Max with more than one result

    Hello;

    I need to write a query that returns the maximum date for a specific transaction that is not a problem, but my problem occurs when I have several transactions with the same date max trans.


    Can someone help me write something which will return only one record from a result set that has more than one record

    Example:

    TRAN_ID - LAW #-TRANS_DATE
    -272-1111111-29/10/1999 00:00:00
    -273-1111111-29/10/1999 00:00:00
    -274-1111111-29/10/1999 00:00:00
    -275-1111111-29/10/1999 00:00:00

    You are referring to your alias at the wrong level, try this:

    select * from (
    select account_transaction_id,
           account_number,
           max_days_in_arrears,
           trans_date,
           row_number() over(partition by account_number order by trans_date desc, account_transaction_id desc) as rn
      from account_transaction atr
     where max_days_in_arrears > 90
       and account_number in (100026, 121189, 100223)
       and trans_date = (select distinct max(trans_date)
                           from account_transaction
                          where account_number = atr.account_number
                            and max_days_in_arrears > 90)
     order by account_number, trans_date
    )
    where rn = 1;
    

    and use code tags please, so that your queries can still be read easily and quickly for us to understand.

    Published by: hoek on March 23, 2009 15:48

  • Video is de-energized when on a call with more than one person

    Hello

    When I'm a Skype call to a video person works very well, but when there is more than one I can no longer see the other participants. There is also no button to end the call and the only way to get out of the call, it's be quiting Skype and it starts again.

    It used to work in the past and Skype was great if not sure whats going on. I'm on Win 10 64-bit with Skype version 7.25.0.106

    Someone at - it ideas?

    Your Skype is not always connected to the Cloud server.

    The correct State shall be:

    Status: NetStateConnected

    Check your hosts filein Windows, DNS/VPN/proxy settings.

    Try first to reset your Windows hosts file:

    https://support.Microsoft.com/en-us/KB/972034

  • Create interactive files with more than one URL

    Hello, here's my problem: I want to create more than one instance of button ranging from the different URL address. The Adobe video workshop, I got the code:

    interactive_test.addEventListener (MouseEvent.CLICK, buttonClickHandler);
    function buttonClickHandler {}
    navigateToURL (new URLRequest ("http://www.adobe.com"));
    }

    This works very well with the one button instance. When I copy and paste the code to another instance of the button, that is to say:

    butn1.addEventListener (MouseEvent.CLICK, buttonClickHandler);
    function buttonClickHandler {}
    navigateToURL (new URLRequest ("http://www.adobe.com"));
    }

    butn2.addEventListener (MouseEvent.CLICK, buttonClickHandler);
    function buttonClickHandler {}
    navigateToURL (new URLRequest ("http://www.adobe.com"));
    }

    I get 1021 in dual function error. I think I understand what is wrong in principle, but don't know how to fix it. MyI knowledge of ActionScript 3 is equal to zero. What I need is the code example that works that I could copy and paste, with the appropriate changes.

    Thanks in advance for your help, Richard

    Use different function names, or flash won't know which function to use:

    butn1.addEventListener (MouseEvent.CLICK, buttonClickHandler1);
    function buttonClickHandler1(event:MouseEvent):void {}
    navigateToURL (new URLRequest ("http://www.adobe.com"));
    }

    butn2.addEventListener (MouseEvent.CLICK, buttonClickHandler2);
    function buttonClickHandler2(event:MouseEvent):void {}
    navigateToURL (new URLRequest ("http://www.adobe.com"));
    }

  • LRT224 impossible to deal simultaneously with more than one VPN tunnel?

    We have configured a client to gateway VPN tunnel group and six in the tunnels of single user gateway on a LRT224. Each unique connection works perfectly using Shrew soft client. But when we try to connect with a second tunnel, the first tunnel disconnects. It seems that the LRT224 cannot process more than one VPN tunnel at the same time? Is there any configuration, that we would have missed?

    TLR log seem to indicate that the Shrew Soft customers use all 192.168.30.0 that their IP address instead of a random IP address in this range.

    Try to set each Shrew Soft client with a specific IP address in the 192.168.30.1 - 50 rank instead of ' use virtual adapter and address randomly.

  • Tabular report with more than one line by line

    Hello

    I designed a sort of Gallery page, a tabular report with only two small columns per line: a thumbnail from a BLOB column and link textual branching to a page showing the full size image with a bunch of textual information on this subject.

    As you can guess I look at the title of the topic, my concern is to display more than one (say 3 or 4) this line by line, in order to avoid a very long 'portrait' page with a lot of white space on the left and right.

    Is there a (not too complicated) way to do it? I might design a special model (?), but I'm not very used to style sheets and stuff.

    Thanks in advance.

    André

    Re: report columns of the SQL query for a couple of ways to do this.

    As your main concern is to maximize the use of horizontal space, custom report template/CSS approach would seem more appropriate, as the number of columns is not resolved.

    It is also possible to do using CSS inline-block property and given that it is now feasible cross-browser and less side effects and potential problems that the use of floats is probably the way to go.

  • How can I search for files with more than one keyword?

    I ve created a few keywords, and some files in my folder are marked by two, three or more keywords.

    Is it possible to search for files by using more than one keyword in the search field?

    Thank you!

    Use the command find (Edit menu) and in the criteria on the side right is a plus sign to add another criterion and set it to your personal wishes.

    Choose from the results and you should be OK

  • How to create an entity with more than one primary key.

    Hello

    JDeveloper Version 11.1.2.4.0

    I am trying to create an entity object based on a table with 5 columns. The combination of them is unique.

    I do the five columns of primary keys, but when I delete a line I: RowAlreadyDeletedException, although always the line exists in the database.

    Also displaying the view sometimes I get Houston-25019: line entity oracle.jbo.Key [1 key 2 null null NULL].



    How to create an entity based on one object several columns in the primary key?

    I don't want to add an additional column to a primary key, because this table is used in many PL/SQL procedures, and I'm not sure that this will not affect the.

    Also using Rowid as a primary key should be avoided.

    Kind regards

    Pamela.

    As I said, the framework is not like that

    Check this old (but still relevant) blog of Sung Im on Table Whose Primary Key entity object can be NULL

    describing the reason behind the behavior you're seeing and the way around.

    Or you use the secondary key rather as described here Wael Abdeen Blog, how to look at the views - part 2 | Oracle ADF as a secondary key composed of more then one column can have null values.

    Timo

  • How can I do data with more than 72 dpi in loose 8?

    When I want to print or send my photos, I get the message that it is printed with less than 220 dpi (in fact it's 70 or 72 dpi). How can I make my data with the normal 600 dpi?

    You must resample the image by Image > resize > image size.

    Please look at this from the help file:

    http://help.Adobe.com/en_US/PhotoshopElements/8.0/win/using/WSae2ea3b149d0c3591ae939f10386 0b3d59 - 7ee0_WIN.html

    Note that for printing, it is desirable to have the resolution = 240-300 px / in. If it's a very large print, you can come out with a lower resolution, as the eye of the observer is at a greater distance.

    The 220 px/guest to come up now and then, and most of the time I ignore it.

    For web work, 72px / is fine.

    If you have additional questions, please repost.

  • Understand the joins with more than one column?

    Hi all

    I want to know if I understand.

    When you join two tables, and the join condition has four columns (two for each table) as follows:

    where d.deptno = e.deptno

    and d.name = e.name

    I think it means the engine must choose "the selection list" when he sees a number of d.deptno (for example 10) equal number in e.deptno, and

    the d.name from the same folder (10) must be equal to the value of e.name.

    I understand?

    Another example, I want to understand, when we say:

    where d.deptno = e.deptno

    and d.deptno = s.deptno

    This means that the number (10) should for example equal to one (10) in the table (e), and the same 10 must be equal to a value in the table (s)?

    Am I wrong?

    Thank you

    Hello

    Yes, what you say is right; but don't take my word for it.  Try it yourself.   Create a couple of small tables.  Insert some data that matches (and will appear in the results of joints) and others that does not (and should not be in the results) and see if the results are what you expected.

  • can you video chat with more than one friend at a time in the new Hello?

    Just wondering if a group of people can video chat all at the same time, or just individual?

    Currently, it is only possible to connect peer-to-peer with another computer.
    To connect multiple computers, you would have to connect via a dedicated server and is currently not possible with WebRTC.

  • HP 15-n205tx: how to reinstall windows preinstalled 8 with more than one partition

    I use 15-n205tx laptop computer with windows 8.1 hp 64 bit pre installed now I need to re install the windows with extra partition only having a c volume now os and any other content is stored in a single volume
    so I need for us as a 2-volume one for data and one for the operating system how to do it please give me the procedure

    Hi @vipinuly,

    If I understand you correctly, you want to create an additional partition on the device.

    If you use provided Hp OEM OS image, it allows you to create the partition during the installation of the operating system.  You can add the partition after installing the OS, but this is not recommended by hp.

    You can create physical partition or volume with Retail OS image.

    Here are a few links to help to create an additional partition

    To create a partition or a logical drive:

    https://TechNet.Microsoft.com/en-in/library/cc727978 (v = ws.10) .aspx

    https://support.Microsoft.com/en-us/help/17418/Windows-7-create-format-hard-disk-partition

    NOTE: With the hp OEM operating system image, perform the recovery on the unit will scan the entire score and data as well as those. Therefore, we believe always take backup of data before you perform the recovery of the unit.

    I hope that answers your question.

    I am an employee of HP, the views expressed here are my personal opinions, not HP.

    Make it easier for others to find solutions, marking my answer "Accept as Solution" if it solves your problem.

    Click the "Thumbs up" button to the left side of my post to recognize the message *.

Maybe you are looking for