Latest Address and the Previous Address in the last 30 days
Morning folks.
I need to find out all Customers whose Address changed based on the Effective Date. The Query should be based as of Effective Date 01-JUN-12 and not SYSDATE. So, we want to check the MAX(effective_date) is <= 01-JUN-12 and the Previous Address's Effective Date is between 02-MAY-12 and 01-JUN-12 (30 days). This would suggest that an Address has changed. For argument sake, the Zip Code is enough to differentiate that an address has changed for now.
Based on the data, I only want to pick up Customer 1002 but not 1001, 1003. As for Customer ID 1003, even though his/her address changed in the last 30 days, we are not interested as the Address effective 1st June was good for a long time.
Also, even though the Address for Customer ID 1001 changed twice in that period, I am only interested for the latest two addresses.
Table CUST_ADDRESS
CREATE TABLE CUST_ADDRESS
"CUST_NO" VARCHAR2(4 BYTE) NOT NULL,
"STREET" VARCHAR2(20 BYTE),
"CITY" VARCHAR2(20 BYTE),
"STATE" VARCHAR2(2 BYTE),
"ZIP_CODE" VARCHAR2(9 BYTE),
"EFFECTIVE_DATE" DATE
);INSERT Script
Insert into CUST_ADDRESS (CUST_NO,STREET,CITY,STATE,ZIP_CODE,EFFECTIVE_DATE) values ('1001','123 Picket Fences','Santa Ana','CA','92704',to_date('31-MAY-12','DD-MON-RR'));
Insert into CUST_ADDRESS (CUST_NO,STREET,CITY,STATE,ZIP_CODE,EFFECTIVE_DATE) values ('1001','12259 Circular Dr','Irvine','CA','92705',to_date('10-APR-12','DD-MON-RR'));
Insert into CUST_ADDRESS (CUST_NO,STREET,CITY,STATE,ZIP_CODE,EFFECTIVE_DATE) values ('1001','22 Green Road','Newport Beach','CA','92709',to_date('03-JAN-12','DD-MON-RR'));
Insert into CUST_ADDRESS (CUST_NO,STREET,CITY,STATE,ZIP_CODE,EFFECTIVE_DATE) values ('1002','12 Parkside Dr','Chicago','IL','60601',to_date('20-MAY-12','DD-MON-RR'));
Insert into CUST_ADDRESS (CUST_NO,STREET,CITY,STATE,ZIP_CODE,EFFECTIVE_DATE) values ('1002','3200 Court Road','Indianapolis','IN','46201',to_date('02-MAY-12','DD-MON-RR'));
Insert into CUST_ADDRESS (CUST_NO,STREET,CITY,STATE,ZIP_CODE,EFFECTIVE_DATE) values ('1003','24 Jaeger St','Bellingham','WA','98225',to_date('01-JUL-12','DD-MON-RR'));
Insert into CUST_ADDRESS (CUST_NO,STREET,CITY,STATE,ZIP_CODE,EFFECTIVE_DATE) values ('1003','145 NE 38th St','Fort Lauderdale','FL','33334',to_date('18-JUN-12','DD-MON-RR'));
Insert into CUST_ADDRESS (CUST_NO,STREET,CITY,STATE,ZIP_CODE,EFFECTIVE_DATE) values ('1003','212 Coral Drive','Miami','FL','33010',to_date('01-JAN-95','DD-MON-RR'));Thanks a bunch.
Edited by: Roxyrollers on Jul 26, 2012 9:35 AM
Something like this
SQL> ed
Wrote file afiedt.buf
1 select *
2 from (
3 select ca.*,
4 max(effective_date) over (partition by cust_no) max_eff_date,
5 lag(effective_date) over (partition by cust_no order by effective_date) prior_eff_date
6 from cust_address ca)
7 where prior_eff_date between date '2012-05-02' and date '2012-06-01'
8* and max_eff_date <= date '2012-06-01'
SQL> /
CUST STREET CITY ST ZIP_CODE EFFECTIVE MAX_EFF_D PRIOR_EFF
1002 12 Parkside Dr Chicago IL 60601 20-MAY-12 20-MAY-12 02-MAY-12Justin
Similar Messages
-
How can I forward mail to multiple recipients? When I add an address, it replaces the previous address.
Using the + button helped--should have been obvious, but I haven't been using it. It works but seems very cumbersome to add one at a time. I had another list of addresses that I could hold down the command button while selecting as many as desired, then click on BCC and double-click on just one of the addresses, and BCC would autofill with all of them. Unfortunately, when I installed the latest Mac system update, I lost that multiple address capability--it's always something!
-
How do I delete and iCloud account that has a former email address and I can't remember the password. All attempts to recover the password have failed!!
Hello there, Gary7023.
The following Knowledge Base article made prove useful for you with the issue you're having:
iOS 7: If you're asked for the password to your previous Apple ID when signing out of iCloud
http://support.apple.com/kb/TS5223
Thanks for reaching out to Apple Support Communities.
Cheers,
Pedro D. -
Please assist with the iMessage configuration. My iMessage used to work with the previous version. With 6.1 I cannot configure iMessage properly. After I sign in using my apple id. It directs me to the next page with all the email add associated with the I. d. After confirming the email addresses it verifies then reverts back to the previous page with the sign in portion. What should I do?
Using FaceTime http://support.apple.com/kb/ht4319
Troubleshooting FaceTime http://support.apple.com/kb/TS3367
The Complete Guide to FaceTime + iMessage: Setup, Use, and Troubleshooting
http://tinyurl.com/a7odey8
Troubleshooting FaceTime and iMessage activation
http://support.apple.com/kb/TS4268
Using FaceTime and iMessage behind a firewall
http://support.apple.com/kb/HT4245
iOS: About Messages
http://support.apple.com/kb/HT3529
Set up iMessage
http://www.apple.com/ca/ios/messages/
Troubleshooting Messages
http://support.apple.com/kb/TS2755
Setting Up Multiple iOS Devices for iMessage and Facetime
http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l
FaceTime and iMessage not accepting Apple ID password
http://www.ilounge.com/index.php/articles/comments/facetime-and-imessage-not-acc epting-apple-id-password/
Unable to use FaceTime and iMessage with my apple ID
https://discussions.apple.com/thread/4649373?tstart=90
For non-Apple devices, check out the TextFree app https://itunes.apple.com/us/app/text-free-textfree-sms-real/id399355755?mt=8
Cheers, Tom -
My ipad recognizes my home network but will not connect to the internet. When I click on AirPort/preferences at the top of the imac screen it says..."AirPort has a self-assigned ip address and may not connect to the internet". If this is the root of the problem,how can I change ip address?
Ipad will connect no problem to other networks.First thing you need I think is to get your iMac connected to the Internet.
Shut down your iMac and you iPad. Then power off your router. Wait 30 seconds and power up the router.
After the router indicates that it is connected to the Internet then start up your iMac and see if it connects. If the iMac connects to the Internet then your iPad should too.
If this power up sequence doesn't work you'll have to dig into the router setup to make sure it is working properly. -
Ever since removing and updating Adobe Flash Player I suddenly cannot get my Yahoo email page to come up with Mozilla 4.0 or 3.6. I can log into yahoo but when I click on Mail from the welcome page I get an error message saying that it cannot find the email address and asking me to check the spelling. I have tried removing and redownloading 4.0 and 3.6. Same problem. With other browsers--Opera, Chrome, and Safari--I don't have this problem. Please help me solve this problem as Mozilla is my default browser.
Its known issue, see;
* https://bugzilla.mozilla.org/show_bug.cgi?id=713014
please open a bugzilla account and add your email in cc list if you want to follow the bug?
Someone having the problem, but when he upgrade Java runtime, his poblem was fixed, make sure your JRE has been up to date?
Also maybe this bug is fixed in nightly?
* firefox.com/beta -
I setup my iCloud account on my iPhone 5 with the wrong e mail address, and I don't remmber the password, I reset my tel and erase all the information on my iPhone in order to try to set up a new iCloud account but when I restart I have a problem agaIn , they ask me to put again the old iCloud user account and password, what I can do in order to start the phone when I don't have the correct e mail and I don't remmber the passcode.?
I have the same problem as the emails go to my iCloud account that I cannot access!!! I cannot answer the security questions as someone else must have set up my iCloud account. Nothing seems to work. It would be great if someone has some ideas as what can be done to recover the situation?
-
I have several old email addresses and accounts with itunes where the email is no longer working, and i have forgotten my password, how do i activate the songs
Welcome to the Apple Community.
The following article(s) may help you.
Look up your old and forgotten Apple ID -
I am trying to download the latest version of iTunes to my PC (windows XP) and I keep getting an error message or two. One is that it can't uninstall the previous itunes version, the other is that it can't find itunes.msi. I have tried removing the old version in add/remove programs, but it says the same error. I tried deleting every thing that has itunes in the file/folder/etc and it didn't help.
(1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
http://majorgeeks.com/download.php?det=4459
(2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
(3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
(4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
(5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time? -
I cannot order photo prints from iphoto. Error says that the delivery address is in an unsupported country. The address and my account are in the UK. Does anyone have any ideas?
I cannot order photo prints from iphoto.
Are you trying to print from iPhoto on your Mac or iPad/iPhone? If you are trying to print form yor Mac, check, if the Print Products Store in the iPhoto Preferences > Advanced is set to U.K.
Also the bimmling address, Delivery address, the country for your AppleID and Credit Card must all be in the same country. Check this document:
http://store.apple.com/uk/help/print_products
-- Léonie -
My mac air OSX10.8.5 won't connect to the internet. It says it has a 'self assigned IP address and therefore cannot connect to the internet'. Network diagnostics is unable to the solve the problem. It happened suddenly for no reason and now I cannot connect except by typing in the configuration settings manually. Please help me!
Use the Airport Utility or log into your wireless device via http and ensure the DHCP/NAT service is enabled. If accessing via HTTP, you will need to manually set an ip within your local subnet (eg: 192.168.0.x).
-
I'm trying to submit a document from pages to a URL address and it keeps giving me the option to load pictures or take a new picture, how do I change this?
If mean by way of Safari, that is correct. Only content of the Camera or Photos apps are available. you will need to find an alternate app such as iCab Mobile for uploading documents to a website.
-
my apple id for icloud is linked to an invalid email address and i do not have the password for the account. I need to delete the account to access my icloud on my iphone. any ideas on how to override this issue?
If you updated the old ID at one point to create your current iCloud ID, temporarily recreate the old ID by going to https://appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID. Click edit next to the primary email account, change it back to your old email address and save the change. Then edit the name of the account to change it back to your old email address. You can now use your current password to turn off Find My iDevice, even though it prompts you for the password for your old account ID. Then save any photo stream photos that you wish to keep to your camera roll. When finished go to Settings>iCloud, tap Delete Account and choose Delete from My iDevice when prompted (your iCloud data will still be in iCloud). Next, go back to https://appleid.apple.com and change your primary email address and iCloud ID name back to the way it was. Now you can go to Settings>iCloud and sign in with your current iCloud ID and password.
-
in imovie 11, with an iMac, latest Mountain Lion, sometimes I insert a still and when I playback, the previous image freezes the last frame and holds during the duration I set for the still, skips both transitions, and jumps to the next clip. why?
in imovie 11, with an iMac, latest Mountain Lion, sometimes I insert a still and when I playback, the previous image freezes the last frame and holds during the duration I set for the still, skips both transitions, and jumps to the next clip. why?
-
A message saying "ethernet has a self assigned IP address and will not connect to the internet" comes up whenever I plug the cable in. Everyone's computers work except for mine work in the house and I have tried different cords and connecting sites.
Please helpOpen System Preferences/Network
Select the Location you use at home
You may need to click the Padlock bottom left at this point if it's locked, enter the admin password to unlock
In the left hand column drag the Ethernet connection to the top of the list and remove any you don't use
Click the Advanced button bottom right
Click the TCP/IP Tab
Set Configure IPv4 to Using DHCP
Click OK bottom right and you should see the Router IP number appear and a unique but similar one for your Mac
Click Ok then click Apply and close the Panel
Maybe you are looking for
-
Oracle 10g Express Edition, Installation Problem
After run # /etc/init.d/oracle-xe configure Oracle Database 10g Express Edition Configuration-------------------------------------------------This will configure on-boot properties of Oracle Database 10g ExpressEdition. The following questions will d
-
Payroll Payment via ALE/IDOC
Hello Everyone, We currently run payroll and process ACH payment information via RFFOUS_T. The information is sent directly to the bank. We have a new request which will require HR Payroll payment information to be sent from our SAP system to anoth
-
How to save SM59 RFC entries during system refreshes
Hello, I will be refreshing our NW04 ERP and SRM QA systems. Our platform is Oracle/Unix. My question is how to export the SM59 RFC entries before the refresh, so I can reimport them after the refresh. I have done this successfully in R/3 4.6c, b
-
Problem in Exception Handling...URGENT
hi, actually i am trying to make a program using Lucene Api and Using NGramSpeller... the information about NGramSpeller is here http://www.marine-geo.org/services/oai/docs/javadoc/org/apache/lucene/spell/NGramSpeller.html#suggestUsingNGrams(org.apac
-
Html Email containing unicode characters [10 Duke Dollars]
Want to be able to send a html email converted from a Word document, i.e. one that contains special characters. I was having a problem trying to send a specific combination of characters: String html = "<html><head></head><body>\n<p>\u0093hello\u0094