Trying to bring back records with and without email address

I have a simple query where I am trying to pull back all of my active subscribers and their email addresses. Most of the subscribers do not have email address but I still want those subscribers in my results. I figure it is a simple join but I can not figure it out. The discus.ems table contains only email addresses and their corresponding RRN's(Acct#'s). The SQL is pasted below. I am using SQL Developer 1.5.5
select
a.STREET_NBR ||' '||
rtrim(substr(a.STREET,33,2)) ||' '||
rtrim(substr(a.STREET,1,28)) ||' '||
rtrim(substr(a.STREET,29,4)) ||' '||
rtrim(substr(a.STREET,35,2)) ADDRESS1,
trim(a.UNIT_NBR) APT,
a.CITY_NAME CITY,
a.STPV_CODE STATE,
a.ZIP_CODE ZIP,
b.email_addr
from
discus.sub a,
discus.ems b
where
a.siteid = 'SUN' and
b.siteid = 'SUN' and
a.rrn = b.sub_rrn and
a.stat_flag in ('E','C','I','V')

For just one column, you could easily do a scalar subquery:
select a.STREET_NBR ||' '||
       rtrim(substr(a.STREET,33,2)) ||' '||
       rtrim(substr(a.STREET,1,28)) ||' '||
       rtrim(substr(a.STREET,29,4)) ||' '||
       rtrim(substr(a.STREET,35,2)) ADDRESS1,
       trim(a.UNIT_NBR) APT,
       a.CITY_NAME CITY,
       a.STPV_CODE STATE,
       a.ZIP_CODE ZIP,
       (select b.email_addr
        from   ems b
        where  b.sub_rrn = a.rrn
        and    b.siteid = 'SUN'
       ) email
from   sub a
where  a.siteid = 'SUN'
and    a.stat_flag in ('E','C','I','V')
;

Similar Messages

  • Send emails from a csv file (grouping records with the same email addresses)

    Writing a script to send emails from a csv which contains record details and email addresses using the Send-Mailmessage cmdlet.
    That part is no trouble, however, the csv file contain records that can have the same email address.
    Is there a way/method I could send the records with the same email address once instead of sending individual email messages?
    Thanks
    Data in the csv file
    Record number, description, email
    1234, Test 1, [email protected]
    5678, Test 2, [email protected]
    1245, Test 3, [email protected]
    4578, Test 4, [email protected]
    $data = Import-csv c:\records.csv
    ForEach($address in $data)
    Send-mailmessage -To $address.emails -from [email protected] -subject "List of records" -Body $data -SmtpServer 192.168.1.1

    The following code does what you are looking for:
    $data = Import-csv c:\records.csv$mx = "192.168.1.1"
    $subject = "List of records"
    $from = "[email protected]"
    $data| Group-Object email|Select-Object Name, @{n='msg'; e={$_.Group| Select-Object -Property "record number", description|ConvertTo-Csv -notypeinformation|Out-String}}|
    ForEach-Object {Send-MailMessage -to $_.Name -Body $_.msg -SmtpServer $mx -Subject $subject -From $from}
    I also recommend no forcing everything into one line.  "One-liner" means "one pipeline" not putting all code on one unreadable line.
    Your code should look like this:
    $data|
    Group-Object email|
    Select-Object Name, @{
    n='msg'; e={
    $_.Group| Select-Object -Property "record number", description|
    ConvertTo-Csv -notypeinformation|Out-String
    }|
    ForEach-Object {
    Send-MailMessage -to $_.Name -Body $_.msg -SmtpServer $mx -Subject $subject -From $from
    Now we can see the code and see that you are still unnecessarily converting back and forth.
    To get the group look at how I did it.
    $body=$_.Group | Format-Table |Out-String
    Isn't that much easier?
    Once you master the pipeline these things will become second nature.  In PowerShell it is not necessary to write lots of code most of the time.
    ¯\_(ツ)_/¯

  • Back-ups with and without Time Machine + G -MINI

    I've got a problem with my new G - MINI 500GB running on an iMac intel 10.5.1/ 230GB. I hope someone can help me with this.
    Overview of problem: I need more hard disc space and opted for an external drive. I would have got a G _Tech Q 500 gb drive but there weren't any immediately available so got the G -MINI 500. Basically this is for video and large audio files. Anyway, I plugged the new MINI in and it pretty much set itself up. Time Machine offered to do a back up of my whole system and contents, I clicked 'accept' and excluding a few items in the options pane in TM it came to around 210 GBs now on the MINI. As I need to take the Mac in for servicing a defective LCD I thought a back up of the system a good idea. I added a few other video files in a separate folder on the MINI. I then thought that was way too much- I will need more than the remaining 245 GBs for future stuff. So I wanted to get some more space back and thinking that it would work pretty much like the Mac's own hard disc and Flash USB drives I just tried to send some files from the back-up folder on the MIni to the trash in the dock. I got a message saying I couldn't trash any files included in a back-up! Kinda locked. I tried trashing one of the video files that wasn't in the system TM back-up folder and it did go to the trash but then I checked the available memory on the MINI hadn't reflected change: the size of that file wasn't added to the 'available memory'. Buff, problem.
    Anyway, I then decided to trash the whole back-up folder and everything else. All went in the trash can in the dock but again, despite expecting the Mini's space to have been freed up, like any hard drive or other storage device, it hadn't been. It still counted 210 GB used up. To make sure I emptied the trash as well but again with no result.
    I couldn't access the trashed files in any way now but the Mini was obviously counting them. What's going on?
    So then used DisK Utility to check the MINI, same result, and then completely exasperated I just went ahead and partitioned it, that seeming the best option at the time. I got the space back but lost about 230 MG in the process. Annoying all in all. Now, I didn't want a Drive that you can't eliminate files from without having to erase the whole bl**dy disk! This seems to be the only way to get space back from the MINI's drive but it seems ludicrous. What am I doing wrong, what don't I know?
    A related question is what's the difference between 'erasing' a disk and 'partitioning' one (in Disk Utility). I can't work this one out. The important question is whether there is a way to delete items from the Mini in order to get back the space they occupy. If not I should have bought something else. I thought G -Tech was supposed to be top end, it is faster than USB I'll give it that for now.
    Thanks in advance for any replies.
    Oh and I'm posting this here because there is nothing in G Tech support about this and the post I sent to the G Tech forum goes unanswered after 2 days already - it seems like a simple question that someone should know the answer to. I want to know if I should just simply copy files to the mini and not bother with system files unless I really want to make a back up. A final question would also be: what exact folders are needed to make just a simple system back up but without all the clutter that you could reinstall from the discs anyway?
    Thanks!
    Message was edited by: Paul Quemades

    If you just want to drag a few files around how about create a folder on the external drive. I know some say you shouldn't do this, but TM will still work even if there is another folder on the same volume you use for backing up with TM. In that folder you can drag whatever into it, just as you are able to do on any flash drive.
    But let's revisit how TM works. I don't understand the detailed operation of TM but once it establishes the initial large copy of your Operating System, subsequent small changes are linked back to the big one, so when in the Time Machine window with all of the different backups over the past days or weeks, clicking on any one of them will show you what appears to be the same thing - the contents of your hard disk. In amongst that will be the small changes or added files.
    To save it recreating by and large the same appearance of your hard disk each time it reuses the initial copy and just adds any changes. It does this by associating any newly changed or newly added file to the base copy, by using links. It is like creating a context for the file, so TM is making file X linked to folder Y which is part of application Z. If we want that file back using TM, it will know that file X has certain associations and it will put it back where it got it from.
    When we drag that same file to another location, it is just that file in isolation. It has no context. The only association it has, is what we remember about it, "that photo was taken at Lucy's wedding" for instance. TM or the computer for that matter doesn't know who Lucy is, or even that she is a human being.
    So in our flesh and blood reality, we see files as objects that have meaning to us, but to the computer it is all just data that has a place and a function. Time machine is a kind of illusion. It is also a Place machine by replacing files in previous places.
    You say to use TM to just store "things like personal documents, music, video and other such stuff, unrelated to system back ups, seems such a fussy and tedious way to do it,..." I agree, but TM has the advantage of being able to restore any file no matter how obscure, or even restore your whole OS if you needed to. You can always retrieve any document or song or photo from TM by going into TM and having it restore that document. Not you dragging and dropping but letting it do it. The other advantage of TM is that it will keep variations of the same file as it is changed, such as various drafts as they are edited.
    Maybe a more suitable backup application for you may be SuperDuper, where you can greatly control what is backs up. The disadvantage of superDuper is it won't keep older versions of something, rather make a fresh copy of that folder each time you use it.
    So you have a few options, but I think if you can get used to opening TM and locating the files that it automatically saved, and telling it to restore those back to your hard drive, it may well serve your needs.
    roam

  • When updating Apps on iphone, it tries to force log-in with old expired email address

    A few months ago, I switched my iphone from an address that I was expiring to another more permanent address. There is no longer any reference to this old expired email address on my iphone. Additionally, I have been able to update my apps through the Apple store when the iphone is plugged into the PC... just fine. However, when I try to update my apps via the iphone (not plugged into the PC), the iPhone prompts for a login to the store--displaying the old expired email address (which is not editable in that prompt) and a field for me to enter the password for that expired email. I have checked all the settings on my iphone and I can't find where on the phone to change the email that is displayed in the password prompt. Could someone please tell me where I can change this? Thanks!
    Also, software details: It's still using 3.1.3 software. I don't know if this 'password  issue' was common with that release or not, but I thought I'd mention it. (And please don't ask me to upgrade the software--as every time I tried to install a new software update (any update), the status bar barely moves 5% forward and then it permanently hangs.)

    You can't chage this.  What's going on is that apps are permanently tied to the Apple ID used to purchase them, and all future updates will require you to enter the password associated with this ID, even if you are not currently using this ID for purchases.  The only way to stop the prompt for your older ID would be to delete these apps from your phone and your iTunes library and repurchase them using your current ID.

  • Trying to make my apple ID and primary email address one and the same!

    As suggested by apple on the 'manage my apple ID page', i have tried to change my apple ID to my primary email address, i press submit and the page just refreshes and does nothing! I'm guessing other people are seeing this issue, is there a resolution? Would like to start using iCloud but can't do so until this is resolved and my ID becomes my primary email.
    any ideas?

    I have the same issue... not sure if it's broken or if it's now in process.  All I know for sure is that this is a poor customer experience.

  • Camera wont capture when Tethering Canon T5i in Lightroom 4.4. Tried with and without card.

    I just unboxed a Canon T5i (700D). I've been shooting with a T2i for the past three years tethered to LR4 with no problem. Now with the T5i, i connect the camera, set up a new tether session and LR detects the camera in the pop up bar, but the sections for Shutter Speed, Aperture, and ISO are blank. The capture button is able to be clicked, but the camera does not respond. When the shutter on the camera is pressed, also no response. I have tried this with and without the SD card. I have used three usb cable and two different computers. I have checked for updates and my firmware is current. The camera is set to manual mode in the on position NOT the video position and I am tethering to a Windows 7 computer. Please help!

    You will need LR5 for that camera to be supported for direct tethered capture.  Or you can use the LR "Watched Folder" feature and use the EOS Utility or other tethering software packages.  Here is a list of some options - http://www.tethertools.com/plugging-in/software/

  • TS3406 I have a connection in the top left hand corner and can access the internet with and without internet on my iphone 5c but I can't receive and create texts and calls, someone please help have tried everything!

    I have a connection in the top left hand corner and can access the internet with and without internet on my iphone 5c but I can't receive and create texts and calls, someone please help have tried everything!

    YOu will need to contact your cell phone provider to resolve those issue, those are carrier features.

  • Attempting to install Adobe Acrobat 7 installer isn't recognizing my product serial number as a valid serial number.  I tried entering it with and without the dashes and neither methods work.  What should I do now?

    I bought a new computer and I'm attempting to install my older Adobe products that I still use, Adobe Acrobat 7 is the issue for now.  I followed the instructions on the Adobe site for installing the older apps, but the installer isn't recognizing my product serial number as a valid serial number.  I tried entering it with and without the dashes and neither methods work.  What should I do now?

    You cannot use your original files and serial number.  See the following for the files you need and the associated serial number(s)....
    Error: Activation Server Unavailable | CS2, Acrobat 7, Audition 3 -
    http://helpx.adobe.com/x-productkb/policy-pricing/creative-suite-2-activation-end-life.htm l

  • When I am abroad (living in Norway) the phone only temporarily  connects to a network. Most of the time is says "no service" in top left corner...I have tried to turn it on/off...with and without sim installed...roaming makes no diff. Can anyone help me?

    When I am abroad (living in Norway) the phone only temporarily (and seldom) connects to a network. Most of the time is says "no service" in top left corner...From advice I have tried to turn it on/off...with and without sim installed...roaming makes no diff. Can anyone help me?

    You're welcome.
    If she has full reception and connection with the same cell phone carrier where you don't - with you both using a SIM card provided by the same carrier while in Norway with an unlocked iPhone, then make an appointment at an Apple Store if there is one nearby to have a diagnostic test run on your iPhone.
    In the interim, I would contact this cell phone carrier in Norway to ensure your iPhone is provisioned properly. They can run a reset for your account that will require powering your iPhone off, so call them with your wife's iPhone for this.

  • Bex Report with and without BIA . . Fails with a dump EXPORT_TOO_MUCH_DATA

    Hi Folks,
    We have a report thats has been running well in production for more about 18 months. This month it did not complete execution.
    We did implement BIA couple of 4 months back and the run times have drastically reduced after the BIA. Now this query execution results in a Dump with and without BIA.  FYI the underlying cube has 195,876,020 records only.
    Name of Runtime error: EXPORT_TOO_MUCH_DATA
    Short text:     Too much data for export.
    What happened?     Runtime error
        The current ABAP program "CL_RSR_CACHE_DO_SPID==========CP" had to be
         terminated because one     of the statements could not be executed at runtime.
    Error analysis: The dataset stored under an EXPORT/IMPORT ID is restricted
    by
    1. The maximum possible size of 2 GB
    2. The length of a data record and the capacity of the sequence counter. This error occurs only if the capacity of the
    sequence counter does not go beyond 255.
    Source Code Extract:
        1 METHOD if_rsr_cache_data_object~get_xstring.
        2
        3   FIELD-SYMBOLS:
        4     <l_xstring>            TYPE xstring,
        5     <l_sp>                 TYPE ANY,
        6     <l_spinfo>             TYPE ANY.
        7
        8   CREATE DATA r_r_xstring.
        9   ASSIGN r_r_xstring->* TO <l_xstring>.
       10   ASSIGN n_s_spid-r_sp->*     TO <l_sp>.
       11   ASSIGN n_s_spid-r_spinfo->* TO <l_spinfo>.
       12
       13 *... Sp has to be the first component
    >>>>>   EXPORT sp = <l_sp> spinfo = <l_spinfo>
       15          TO DATA BUFFER <l_xstring> COMPRESSION ON.
       16
       17 ENDMETHOD.
    Referred to the below note 0001232573
    which says to have 'RSRCACHE_ITAB_COMPR'  parameter using report SAP_RSADMIN_MAINTAIN
    Note say the below (It might be a little tricky, to find an appropriate value for 'RSRCACHE_ITAB_COMPR' as it heavily depends on the query-specific data structures that are stored in the cache. The general recommendation would be to start with a value of about 5000. Test this with a query, that dumped previously. In case the dump persists reoccurs, reduce the value of the parameter significantly. Otherwise, if no dump occurs but you face noticeably longer runtimes, increase the parameter.)
    We are trying not able to get to the right parameter value. (changed it from 5000, 4000, 3000, & 1000) without much  help.  Did any of you had to change this parameter. How low or High can this parameter be changed?
    We would like to understand if changing any other parameters would help in RSADMIN table would help?
    Any thoughts from the experts would be appreciated
    Thanks,
    FHF

    Hi,
    Are you running the report for all the selections(all the data )?
    execute the report with data selection and check?
    Is the data in the Ic - compressed?
    Regards
    KP

  • STO with and without delivery

    Hi All,
           sorry for troubling you all again. last question on STO.
    1) when STO is required to be with delivery only then only we use IMG > step up stock transport order> Assign Document Type, One-Step Procedure, Underdelivery Tolerance
    there is no need to assign document type in the step--> Assign Document Type, One-Step Procedure, Underdelivery Tolerance,  if it is without delivery in step --  ?  is it like this?
    i created a document type <b>zubd</b> by copying the std UB. and did the setting in the STO with the help of SD consultant.
    i assigned the new STO document type  ZUBD in step
    Assign Document Type, One-Step Procedure, Underdelivery Tolerance
    now when i am trying to assign document type UB in the step;
    Assign Document Type, One-Step Procedure, Underdelivery Tolerance
    <b>the system is giving me error message : an entry already exists with the same key</b>
    am i right if i make the interpetation for STO with and without delivery like this:
    1) for STO without delivery there is no need to do IMG in the step Set up stock transport order. we can use the std doc type UB or the one created by copying UB.
    2)  for STO with delivery we have to do the settigs in IMG for set uo stcok transport order
    thanks and regards
    Kavita

    Hi Kavita,
    You are Right,
    Assign Document Type, One-Step Procedure, under delivery Tolerance
    In this step, you define which document type is to be used for a certain combination of supplying plant and receiving plant.
    <b>There is no need to maintain IMG setting forStock Tranfer Order  Without SD delivery</b>. because main moto of assignment of Document type is to specify which delivery type is to be used.
    for this we allready maintain IMG setting before this srep >Assign Document Type, One-Step Procedure, Underdelivery Tolerance at
    <b>Assign Delivery Type and Checking Rule</b>:
    In this step, you specify whether an SD delivery is to be created in the case of a PO with a certain combination of supplying plant and document type. You can also specify which delivery type is to be used.
    The delivery determines how a delivery is handled.  I.e. stock transfers without a billing document or for stock transfers with a billing document.
    Regards
    Sanjay l

  • Google search does not work. It does not bring back any results and disables my internet connection until I close the brower, wait, and then open it again.

    Google search does not work. It does not bring back any results and disables my internet connection. I have to close the browser, wait, and then open it again. It only seems to happen when I am signed into my Google account. If I am signed out the search functions properly.

    Do a malware check with some malware scanning programs on the Windows computer.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of their databases before doing a scan.<br /><br />
    *http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    *http://www.superantispyware.com/ - SuperAntispyware
    *http://www.microsoft.com/security/scanner/en-us/default.aspx - Microsoft Safety Scanner
    *http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    *http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    *http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also:
    *"Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked

  • Whine Present With and Without Battery

    My whine occurs with or without using the battery.
    Also, I run Photobooth and the whine disappears. However, as soon as I close Photobooth, it comes back.
    It seems like my whine is more prevalent than other people's....
    Anyone else experiencing this?
    Mine is week 12

    All cpu whines occur with and without battery, but with the AC adapter plugged in, its not as bad as with the battery. Before you close Photo Booth click on a still picture at the botton then quit Photo Boot and your whine will go away. Also the week # of your MBP has nothing to do with whether or not you have the whine.. maybe in the future it will determine if you have it or not but thats not the case so far.

  • Game center keeps logging me out, and then tries to log in with an old email address!

    It will stay logged in for so long and then I will open an app and it will ask me to log in with my old email address, which has been deleted from everywhere I can think of. Help!!!!!

    I've tried all the tricks but have the same issue. iPad 2 with latest iOS update. If I force close all apps and power off then go into settings and sign into Game Center again  it stays ok for about a day. But then it's back to signing in every few minutes as I switch games. Apple it's on you now!

  • SAPU with and without Modi As..!

    From which table and with what filter we can get the list of with and without modification assistance objects which will get listed in SAPU?

    Hello Dhamodaran,
    You can do it by simply selecting the check boxes in the SPAU transaction. In the SPAU Transaction screen you will be able to select objects which can be modified with and without modification assistant.
    If you are trying to download this list you can so it by System->List->Save.
    Thanks,
    Sai

Maybe you are looking for