How to determine how many times result set have the same value

HI -.

I do a report that will be used for the analysis of trends in payment.

My initial result set looks like this:
HOUSEHOLD_ID     JAN_PMT     FEB_PMT     MAR_PMT     APR_PMT     MAY_PMT     JUN_PMT     JUL_PMT     AUG_PMT     SEP_PMT     OCT_PMT     NOV_PMT     DEC_PMT
90026845409     1     1     1     1     2     1     1     1     1     0     1     0
(number of lines, of course, pivot table result set)

I need to determine the households that have a value > 0 in three or more consecutive months.

I hope that someone will have some suggestions because that the only solutions I come up with right now would be a nightmare of coding (lots of "GOLD"), and I assume (hope) there's a better solution out there.

Thank you!
Christine

If you are limited to only 12 months I would use GOLD in conjunction with the sign function.

sign of a positive number returns 1
sign of 0 returns 0
sign of a negative number returns - 1

Really, it doesn't look like bad lto for me. Obviously if you have a numbe rof months variable must be a different solution.

with the data
as
(
Select hh '90026845409', 1 jan, Feb 1, 1 March, 1 April, 2 may, 1 June, 1 July, August 1, 1 sep, oct, 1 nov, dec double 0 0
)
Select * from data
where
(sign (jan) sign (feb) + sign (mar)) = 3
or
Sign (Feb) + Sign (Tue) + Sign (APR) = 3
...
or
Sign (Oct) + Sign (Nov) + Sign (DEC) = 3

Tags: Database

Similar Questions

  • How many user take RDP at the same time with different user login ID in Server R2 2012

    How many user take RDP at the same time with different user login ID in Server R2 2012?

    How many user take RDP at the same time with different user login ID in Server 2008 R2?

    How many user take RDP at the same time with different user login ID in Server 2012 starndard?

    How many user take RDP at the same time with different user login ID in Server 2008 standard?

    This issue is beyond the scope of this site (for consumers) and to make sure you get the best answer, we need to ask either on Technet (for IT Pro) or MSDN (for developers)

    If you give us a link to the new thread we can point to some resources it
  • How many times if you change the printheads to printer large format?

    We have a HP Z5200PS (large format printer) on my place of work. I was wondering how many times we should replace the print heads? Or, rather, how often usually takes to replace? It will prompt you or if you change them as part of a regular maintenance?

    Thanks for your comments!

    Hi OatesC,

    The Designjet is a commercial product.   I'm linking you to the forums your question Designjet repost for better coverage.

    Designjet Forums

  • How to identify columns that have the same data in a SQL query or function?

    Deal all,

    How to identify columns that have the same data in a SQL query or function? I have the sample data as below

    DEPT_IDEMP_IDCome on
    !CITYSTATECOUNTRY111 June 1983DELHIHUMAN RESOURCESIndia1218 January 1987DELHIHUMAN RESOURCESIndia1328 November 1985DELHIHUMAN RESOURCESIndia144 June 1985DELHIHUMAN RESOURCESIndia255 June 1983MUMBAIHDIndia266 June 1983MUMBAIHDIndia277 June 1983MUMBAIHDIndia288 Jun. 1983MUMBAIHDIndia399. June 1983GURGAONDLIndia31010 June 1983GURGAONDLIndia

    Now, I want to Indify columns that have the same data for the same Department ID.

    Is it possible in sql unique or do I have to write the function for this? Pls Help how to write?

    Thanks in advance.

    You can try this?

    WITH T1)

    DEPT_ID, EMP_ID, DATE OF BIRTH, CITY, STATE, COUNTRY

    ), ()

    SELECT 1, 1, TO_DATE('1.) June 1983', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 1, 2, TO_DATE('18.) January 1987', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 1, 3, TO_DATE('28.) November 1985', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 1, 4, TO_DATE('4.) June 1985', 'JJ. LUN. (YYYY'), 'DELHI', 'HR', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.5, TO_DATE('5.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.6, TO_DATE('6.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.7, TO_DATE('7.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 2.8, TO_DATE('8.) June 1983', 'JJ. LUN. (YYYY'), 'BOMBAY', 'HD', 'INDIA' OF THE DUAL UNION ALL

    SELECT 3, 9, TO_DATE('9.) June 1983', 'JJ. LUN. (YYYY'), 'GURGAON', 'DL', 'INDIA' OF THE DUAL UNION ALL

    SELECT 3.10, TO_DATE('10.) June 1983', 'JJ. LUN. (YYYY'), 'GURGAON', 'DL', 'INDIA' OF THE DOUBLE)

    SELECT DEPT_ID,

    RTRIM (XMLAGG (XMLELEMENT(A,VALS||',')). Extract ('//Text ()'), ',') COLUMNS_WITH_DUPLICATE

    DE)

    SELECT * FROM)

    SELECT DEPT_ID,

    EMP_ID,

    Date of birth

    CITY,

    STATE,

    COUNTRY

    DE)

    SELECT DEPT_ID,

    EMP_ID,

    Date of birth

    CITY,

    STATE,

    COUNTRIES,

    COUNT (*) OVER(PARTITION BY DEPT_ID ORDER BY EMP_ID DESC,DOB DESC,CITY DESC,STATE DESC, COUNTRY DESC) RN

    DE)

    SELECT DEPT_ID,

    CASE WHEN(CEID>1) AND THEN 'YES' ELSE 'NO' END AS EMP_ID.

    CASE WHEN(CDOB>1) THEN 'YES' ELSE 'NO' END AS DATE OF BIRTH,

    CASE WHEN(CCITY>1) AND THEN 'YES' ELSE 'NO' END AS CITY.

    CASE WHEN(CSTATE>1) AND THEN 'YES' ELSE 'NO' END AS STATE.

    CASE WHEN(CCOUNTRY>1) THEN 'YES' ELSE 'NO' END AS A COUNTRY

    DE)

    SELECT DISTINCT

    DEPT_ID,

    CEID,

    CDOB,

    CITY,

    CSTATE,

    CCOUNTRY

    DE)

    SELECT DEPT_ID,

    COUNT (*) TO THE CEID (DEPT_ID PARTITION, EMP_ID),.

    COUNT (*) ON CDOB (DEPT_ID SCORE, DATE OF BIRTH),

    COUNT (*) ON THE CITY (DEPT_ID PARTITION, CITY),

    COUNT (*) ON CSTATE (DEPT_ID PARTITION, STATE).

    COUNT (*) ON CCOUNTRY (DEPT_ID, COUNTRY PARTITION)

    FROM T1)))

    WHERE RN = 1)

    UNPIVOT (CLO FOR (VALS) IN (EMP_ID, DATE OF BIRTH, CITY, STATE, COUNTRY)))

    WHERE COLS = "YES".

    DEPT_ID GROUP;

    OUTPUT:

    DEPT_ID COLUMNS_WITH_DUPLICATE
    --------- ------------------------

    1 CITY, COUNTRY, STATE
    2 CITY, COUNTRY, STATE
    3 CITY, COUNTRY, STATE

    Post edited by: Parth272025

  • How many times firefox automatically save the Favorites of the user?

    In the example given in the tutorial of Firefox, it would seem that Firefox performs an automatic backup of the Favorites of the user in a random manner, that is, sometimes daily and sometimes several days (weeks) pass without backup automatically bookmarks in Firefox. No one knows how many times we rely on Firefox by performing an automatic backup of bookmarks? I'm new to Firefox and want to know if I need to perform manual backups regular bookmarks for more safety in case of crash. Thank you!

    Firefox will create JSON backup each day you launch Firefox. If you keep your computer and do not close Firefox then it may not be a JSON backup created.

    If you close Firefox and no backup is created on the next start, then you can have an extension interference or other problems with your software folder or cleaning of profile (e.g. CCleaner) which removes backups.

  • How many time Toshiba will support the Tecra M7

    I am from Poland. On the Poland, Toshiba website it is info on tecra m7. On the europe of the site also. So is this the end of this model in Europe. You have all the information.

    What the support of software and vista drivers. I love this new model and bought it, I thought that it will continue to exist for a long time in the company of toshiba. Do you now st new bios (3,1)

    Who knows how many time, but don t worry buddy. As much as I know the M7 is not an old unit. June 2006, was the first expedition.
    But as you know mobile technology is a fast business, and it seems that there are a lot of new laptops on the market.

  • How many times can I use the discount of the University?

    How many times can I use my University discount?

    See the information below (from policy refund & sales at the bottom of http://www.apple.com/shop/browse/campaigns/education_pricing ):

    Faculty, staff and students to purchase from the Apple Store for education individuals will be able to buy the following quantities of product per academic school year. Not all products have special prices for education.

    1. 1 desktop computer: one (1) may be purchased per year
    2. 2 mac mini: one (1) may be purchased per year
    3. 3. Notebook: one (1) may be purchased per year
    4. 4 iPad: two 2 can be purchased per year
    5. 5. display: A maximum of two 2 may be purchased per year
    6. 6. software: A maximum of two 2 per software title may be purchased per year
  • How many times can you use the serial number to download the cd

    can help how many times we use the serial number to download the photoshop elements 11 cd

    Download Photoshop Elements products | 10, 11, 12, 13

    Mylenium

  • Y does it does anyone know how many client can connect at the same time on the Microsoft VPN server?

    Hello everyone

    Is there anyone know how many client can be connected same time on microsoft VPN Server?

    Thank you

    Original title: VPN Windows Server 2012

    Hello

    Post your question in the TechNet Server Forums, as your question kindly is beyond the scope of these Forums.

    http://social.technet.Microsoft.com/forums/WindowsServer/en-us/home?category=WindowsServer

    See you soon.

  • How many times can I use the Windows XP Professional key?

    Hi all

    I know there are tons of answers there, but the answers are all different.

    I bought two copies of WinXP Pro 3 years for $100 each.

    Since then, I used the keys to many times since I had and have several different computers.
    I would just format a model when I catch a virus if I get new hardware, etc.

    I read on a forum that people can use the internet to activate about 30 times a button.
    Some say that only once.

    What is the right answer? I know that I used it at least 5 times on each key.

    Main reason I ask is because I want to buy Windows 7 and upgrade all my comps finally.

    Upgrade from version and the full version of different in the activation process of Windows 7?
    Since I have Windows XP Original, I would get the upgrade version, but if it is different from the full version, I would buy the lot.

    Thanks in advance!
    Mike

    You can move a copy to the detail of Windows to another computer. You can not have it installed on two computers at the same time, however.

  • How many times can I install the master collection adobe? (on the same mac)

    I restore my mac and office and I have already install my collection of adobe masters twice before. I remember Adobe master collection allow only three times to install. Can I reinstall my mac and desktop again? They are the same computer I have installed before. Because I was afraid that it will be more than 4 times to install. (but in fact they are the same that I have installed before)

    The Adobe license allows TWO activations, not three

    If you do not disable and wipe your hard drive, a new installation, even on the same computer, counts as a new activation

    If you have activated twice, you will not be able to activate a third time, until what contact you Adobe for the activation of your account reset

    Chat/phone: Mon - Fri 05:00-19:00 (US Pacific Time)<=== note="" days="" and="">

    Don't forget to stay signed with your Adobe ID before accessing the link below

    Serial number and activation support (non - CC)

    http://helpx.Adobe.com/x-productkb/global/Service1.html

  • How many times should I empty the cache memory?

    I had problems with various Web sites and on other users advice made a full cache clear. I noticed an immediate improvement in the speed of loading pages. Do you have this help and if yes how often should I clean the cache? It is 420MB.

    Thank you

    I don't see how that can possibly be associated with the cache. The cache contains files from Web sites, such as images, scripts and style sheets. So when you visit a page you have already visited, you do not need to download everything again. The cache allows the pages to load faster, not slower.

    The cache is a fixed size, as well as the files are automatically deleted as new ones are cached. Unless you have to have some sort of issue as Web sites to research wrong, there is no need to delete it manually.

  • How many times can I use the Dell restore cd that came with my system?

    I ran the cd of restoration over 3 times and nothing has changed that I have I'm restoring an old dell dimension xp. I thought that this would erase it clean and set of parameters by default now I can't boot the OS and not much has changed. I get a blue screen with an error message window was closed to protect the computer and search for viruis.  I found my way in the tree view of the symptoms and I've been running tests, I don't know if this will help, and I still really need help because I am very new to the use of this forum, and now I'm tender hand on this Mac laptop. Boy, any help would be greatly appreciated this whole thing with computers, it's a change of lifestyle.

    A Dell Dimension 4700 Series are of desktop computers; and, as such, do not come with wireless capabilities.

    Connect with an Ethernet cable to your router.

    If you want to use a wireless connection with it, you must either purchase a Wireless USB adapter or a card PCI of Wirelesss.

    Here is an example of both:

    USB adapter: http://www.dlink.com/products/?pid=722

    PCI Wireless Card: http://www.ebay.com/sch/i.html?_nkw=wireless+PCI+card

    And here's all the information from Dell on Dell Dimension 4700 series.

    http://support.Dell.com/support/eDOCS/systems/dim4700/en/OM/Y69490LRs.PDF

    And it can help, too (Service Manual):

    http://support.Dell.com/support/eDOCS/systems/dim4700/SM/index.htm

    See you soon.

    PS You are welcome, the ROCKS of XP

  • How many times is - x 64 (the nightly version) updated to firefox

    The latest version [firefox - 36.0 has 1 .in - US.win64 - x86_64.installer.exe] allows Adobe Flash to update as the 'Install now' button does not appear in this version. I met errors like this before in the 32-bit version, but will be to use only 64-bit versions as the 32-bit versions are too slow. So what happens is that I often have to use Google Chrome, which is not as flexible and not usable for me. Thank you
    / * Philip * /.

    Check-ins happen almost every day on the Nightly and Aurora channels development and therefore, there is an update of each of these days. Sometimes, there are the odd respin build. If you miss an update there may be a patch full partial vs. These are more intended for testers and developers and not for regular users.

    As for Win64 earlier there will be a supported version is Firefox 37.0 in first phase. https://wiki.Mozilla.org/Firefox/Win64

  • Satellite A200 - 14 d: how many times can I change the screen resolution

    I would like to ask if often resolution change may damage the screen of my Satellite A200 - 14 d?

    Because now I'm programming in Assembly in resolution 640 x 480, and whenever I run a program, the screen should change its 1280 x 800 to 640 x 480 resolution, and it takes 1-2 seconds: it is empty, the backlight turns off, then the new resolution appears. I would like to ask if it permanently (often) could damage my LCD?

    Thank you.

    Don't worry man, it will not damage the screen ;)
    You can change the screen resolution often unhesitatingly ;)

Maybe you are looking for

  • Find my external hard disk Firefox profile?

    My old laptop was damaged, but I managed to save my hard drive. Now I have this hard drive is connected as an external drive to a new computer. I need to restore my old profile bookmarks. However, when I type %APPDATA%\Mozilla\Firefox\Profiles\ in th

  • How can I remove malware found by ClamXav?

    How can I remove a malware file in MAIL/sent by ClamXav?

  • HP Mini 1000 and Windows XP

    Given that Windows XP support is being discontinued, what are my options for this computer?  I have to run Windows programs on this computer. Thanks in advance, Roger

  • How can I uninstall/reinstall the games?

    I'm having a problem of the pixalating to display only when I try to play all the games that come with Windows 7, hearts, Minesweeper, etc.. There are no other games installed. This is on a Dell Studio 1537 laptop. When I open any game, there are sma

  • Download Podcast for rocket live - is it possible?

    First of all... Thanks to all to help get started. Without this forum I still fumble. Question: Download on PC can be bypassed with a direct say in a PODCAST download? I read on AUDIBLE and will try that next.