Best way to code to retrieve a field that matches one value

Hello,
Thanks for reading this post!
I have a data set where users can be part of workgroups. I want to exclude any user that is part of workgroup 2 and 7, and only retrieve users that are solely part of workgroup 2.
There can be users that are part of just workgroup 7 or other workgroups like 4, 5, 6 etc., but I only want users that have only workgroup 2 and no other workgroup.
CREATE TABLE users
( user_id NUMBER(10)
, user_lastname VARCHAR2 (50)
, workgroup NUMBER(10)
INSERT ALL
INTO users(user_id, user_lastname, workgroup) VALUES (1, User_lastname1, 2)
INTO users(user_id, user_lastname, workgroup) VALUES (1, User_lastname1, 7)
INTO users(user_id, user_lastname, workgroup) VALUES (2, User_lastname2, 2)
INTO users(user_id, user_lastname, workgroup) VALUES (2, User_lastname2, 7)
INTO users(user_id, user_lastname, workgroup) VALUES (3, User_lastname3, 2)
INTO users(user_id, user_lastname, workgroup) VALUES (4, User_lastname4, 7)
I want to exclude any users that have both workgroups 2 and 7 and
only retrieve users that have just 2. In this case I only want to retrieve user_id 3.
Thanks!
Edited by: dbarcell on Oct 8, 2011 11:44 AM
Edited by: dbarcell on Oct 8, 2011 11:48 AM
Edited by: dbarcell on Oct 8, 2011 11:51 AM

dbarcell wrote:
Hello,
Thanks for reading this post!
I have a data set where users can be part of workgroups. I want to exclude any user that is part of workgroup 2 and 7, and only retrieve users that are solely part of workgroup 2.
There can be users that are part of just workgroup 7 or other workgroups like 4, 5, 6 etc., but I only want users that have only workgroup 2 and no other workgroup.
CREATE TABLE users
( user_id NUMBER(10)
, user_lastname VARCHAR2 (50)
, workgroup NUMBER(10)
INSERT ALL
INTO users(user_id, user_lastname, workgroup) VALUES (1, User_lastname1, 2)
INTO users(user_id, user_lastname, workgroup) VALUES (1, User_lastname1, 7)
INTO users(user_id, user_lastname, workgroup) VALUES (2, User_lastname2, 2)
INTO users(user_id, user_lastname, workgroup) VALUES (2, User_lastname2, 7)
INTO users(user_id, user_lastname, workgroup) VALUES (3, User_lastname3, 2)
INTO users(user_id, user_lastname, workgroup) VALUES (4, User_lastname4, 7)
I want to exclude any users that have both workgroups 2 and 7 and
only retrieve users that have just 2. In this case I only want to retrieve user_id 3.
Thanks!
Edited by: dbarcell on Oct 8, 2011 11:44 AM
Edited by: dbarcell on Oct 8, 2011 11:48 AM
Edited by: dbarcell on Oct 8, 2011 11:51 AMSQL> CREATE TABLE users
( user_id NUMBER(10)
, user_lastname VARCHAR2 (50)
, workgroup NUMBER(10)
INSERT ALL
INTO users(user_id, user_lastname, workgroup) VALUES (1, User_lastname1, 2)
INTO users(user_id, user_lastname, workgroup) VALUES (1, User_lastname1, 7)
INTO users(user_id, user_lastname, workgroup) VALUES (2, User_lastname2, 2)
INTO users(user_id, user_lastname, workgroup) VALUES (2, User_lastname2, 7)
INTO users(user_id, user_lastname, workgroup) VALUES (3, User_lastname3, 2)
INTO users(user_id, user_lastname, workgroup) VALUES (4, User_lastname4, 7) 2 3 4 5
Table created.
SQL> SQL> 2 3 4 5 6 7 ;
INTO users(user_id, user_lastname, workgroup) VALUES (4, User_lastname4, 7)
ERROR at line 7:
ORA-00928: missing SELECT keyword
test data is FUBAR!

Similar Messages

  • Best way to code a simple wait/delay?

    What is the best way to code a simple wait/delay so that my application idles for a few seconds before continuing? I'd rather not use a loop to do this and am looking for a better solution. This code will not be threaded, so I'm not going to use sleep(). TIA

    From the OS level, yes it is a process; from Java's perspective, it's a Thread, at least in Sun's implementation.
    According to the JVM specification, section 2.1.9, "The Java virtual machine initially starts up with a single nondaemon thread, which typically calls the method main of some class. The virtual machine may also create other daemon threads for internal purposes. The Java virtual machine exits when all nondaemon threads have terminated."
    http://java.sun.com/docs/books/vmspec/2nd-edition/html/Concepts.doc.html#33308

  • Visio Drawing Using Data Graphics with data that has a field that contains Multiple Values.

    I am working on creating a drawing for SMTP connectors.  I decided I would use a Data Graphic connecting to a spreadsheet.  In the spreadsheet there are a few fields that are Multi-Value fields.  For instance SmartHosts contains multiple Ip
    address.  I am trying to get this to format things so that the IPs show on the next line down instead of continuing on the same line until it wraps. 
    Does anyone know a way I could do this?
    Jeff C

    Hi Jeff,
    Arrange the IP values in spreadsheet using Alt+Enter (Use this key pair as a separator between two IP values). Now link this spread sheet to Visio. The values should appear in the same manner in data graphics as your expectation.
    Let me know if you meant something else.
    Thanks,
    Dheeraj 

  • Best way to handle inversion of custom fields?

    We've added some additional numeric fields, such as quantities, to some of the LO extractors.
    What is the best way to handle the reversal of these additional fields when reversal records come over on the extractor?  I tried switching on the "inversion" switch in the extractor and this didn't work - found OSS note 382779 which explains that this is expected behavior, that one must put some logic in the user exit to do the inversion.
    Is it just a matter of coding if the ROCANCEL field (mapped to 0STORNO in BW) is 'X' or 'R' to flip the sign of the numeric field we added?  But is it better to put this in the R/3 user exit or in a start routine in the transfer rules do you think?  Does flipping on the "inversion" switch make any difference at all in this case?
    Thanks for your help!
    Chris

    Hey,
       I dont this inversion which matters  as you said you added quantity type of fields. If i were you i will do the user exit which can take care good but tranfer routine also helps in most of the cases.

  • I just bought a new Macbook. What's the best way to transfer all my info from the old one?

    Hey everyone! I just got my new retina display Macbook Pro, and I'm trying to figure out the best way to transfer all my music/photos/files/data/etc. from my old Mackbook Pro. I have a 1TB external drive and an 8GB flash drive that I can use if I need to. Any sugestions? Thanks!

    What i did with mine, I cloned the drive of my old macbook to my external drive using carbon copy cloner.
    Once i was done with the clone - i used migration assistant to transfer my apps/data/pictures/files over my new macbook....
    when using migration assistant - do not transfer your old settngs and if you're doing an app transfer, only transfer the ones you need and that you know will work with your Retina...
    good luck..

  • Best way to Replace OLD Time Capsule with a new one

    What is the best way to replace an old Time capsule with a new Time Capsule in an existing wireless network?

    IMHO..
    Start over..
    Put the new TC in place and configure .. completely differently to the old one. That means you have to go around and reset everything to connect if you use wireless.. and you should forget all the old configuration beforehand.
    You can of course try and slip it in using identical names and identical settings.. but the computers are not fooled.. the BSSID is different. And other issues tend to arise.
    Use naming that is short, no spaces and pure alphanumeric.
    See Pondini post C9 here.
    http://pondini.org/TM/Troubleshooting.html
    It may take more time to start with.. depending on how many devices you have.. but in the end, you can get much less problems out the other side.. which are extraordinarily hard to diagnose and fix..
    But that is IMHO.. others are welcome to dispute that and may find a full swap using old settings copied to a file and copied back to the new TC work fine.
    There are any number of posts around about doing just that.
    I will post one if I see it..
    I do confess to being a bit of a purist when it comes to this stuff.. but then I used to do computer support and trying to fix the messes people got themselves into .. inevitably they tried to cut corners.. instead of doing the setup from scratch.

  • Highlight fields that changed its value

    Hi all,
    I'm working on a form that goes from one user to another.  It's a fairly large and complex form (about 7 pages) with calls to multiple web  services.
    After the form is opened and some information is  populated into the fields, a user will be able to change the values of some  fields, and then will submit the form.  The next user in the process will get the form and open it up from  his/her To-Do queue.  The fields with the  changed values (changed by the previous user) would need to be visually  identified to this next user.  When that  user finishes working on the form and submits it, it is opened by the next user  in line. and the changed information STILL needs to be visually identified.  We have found it is easy to highlight a  changed field while a user is working on the form (using the change event) but  it is more difficult to make that highlight stay visible all the way through the  process as different people get the form. I thought about making a hidden field  for every field in the form and compare the values in the validation event. but  this would effectively double the size of the form and all those hidden values  would need to be included in the XML schema (doubling the size of the XML  schema).
    We would appreciate ANY assistance on a proper  approach.

    That does make things clearer.  You will have to save the change information in the XML.  I realize that you don't want to save an xml node for every field, but there is a better way.  You can use scripting to add data nodes to the XML data in the form.  I'm thinking of the following:
    Include an empty container node in your XML schema: <HighlightedFields></HighlightedFields>
    When a field is changed, in the field's change event call a common script: HighlightChangedField, passing in the object.  The script will highlight the field (set the border a certain color or whatever).  It will also add node underneath the HighlightedFields data node with the SOM expression of the field.  The SOM expression is the "path" of the object in the form heirarchy, sort of like an xpath.  So if you have a subform named Subform1 and you change the Name and Address textfields, you might end up with something like:
    <HighlightedFields>
        <HighlightedField>
            <SOMExpression>xfa[0].form[0].myform[0].Subform1[0].Name[0]</SOMExpression>
         </HighlightedField>
        <HighlightedField>
            <SOMExpression>xfa[0].form[0].myform[0].Subform1[0].Address[0]</SOMExpression>
         </HighlightedField>
    </HighlighedFields>
    The upside of this is that you only store XML nodes for what is changed instead of needing a specific XML node for each field.  The downside is that you will need a call to the common script in every field's change event: HighlightChangedField(this);
    Now, to make this work when a form is loaded the next time, in the initialize event at the topmost subform in the hierarchy you add a script that walks the HighlightedFields data node, and for each HighlighedField entry you highlight the contained object.  You can get a reference to an object using its SOM expression, so just take the SOM expression from each entry and do an xfa.resolveNode(SOMExpression) to get the object, then set whatever attributes you want to highlight the field.
    The big issue I see with this would be if you have dynamically added objects on your form.  In that case you would probably need to store the instance index along with the SOM expression for each changed object, then use that instance number when highlighting on form load.
    I don't know how much you know about scripting, so I hope the above makes sense.  If you need more help I can try to mock something up.
    Regards,
    Kevin

  • What is the best way to set property to multiple fields?

    Dear Experts
    My requirement is, I want to allow user to fill only some specific fields in the form. When user A opens the form, he may be able to fill Field1~Field10. And when user B opens the form, he may be able to fill Field11~Field20.
    I have implemented one solution as below to do this but the performance is poor.
    - Recursively poppulate all fields into array
    - Iterate all fields to make it read only (Field.access = 'readOnly')
    - Iterate all fields and compare with enabled fields list, if any field matchs then enable it (Field.access = 'open')
    (I have list of enabled fields for each user like this : form1[0].page1[0].ProjectNumber[0],form1[0].page1[0].CustomerName[0],form1[0].page1[0].Fi nishedGoodsNo[0],......)
    Is there a better way to reference multiple fields to set their property?
    I know, we can reference multiple fields using FormCal like Field[*] but is it possible to complete my case?
    Any suggestion?
    Thanks

    We make web application which accept the form designed by end user. So we try to make them most comfortable to use LyfeCycle Form Designer by creating tds template for them and it contains the script which enable/disable fields. So the user don't have to set all fields to read only. Our script will do it.
    Anyway I will adjust when enabling them.
    One more doubt.
    When I type in the script editor, it lists member :
    - all, the hint says "Returns the collection of like-named, in-scope nodes. If the node has no name, a like-classnamed collection is returned."
    - classAll, the hint says "Returns the collection of like-class, in-scope nodes."
    Can I get all fields by these member? get fields from class?
    It would be good if it can do.
    I try to check XFA reference and use them but cannot get how it work.
    Could you please suggest?
    Thanks

  • Best way to store and retrieve data in a text file

    I want to write to a text file and then in another Applescript read the same data into an array
    I'll have 5 lines of text data
    What would be the best format?
    CSV?
    XML maybe?
    Just a plain file with each line of data separated by pressing enter?
    Thanks
    Omar

    I agree with Frank - for just 5 lines, simple text is probably sufficient.
    However, if the point is just to pass data between two AppleScripts you could even use native AppleScript objects - for example, you could write the list (array) to the file and then read it back in directly, e.g:
    Write the data:
    -- create a list of any types:
    set myList to {"a string", 3.14159, "foo", {name:"Joe", age:21}}
    -- create a file
    set f to open for access (choose file name) with write permission
    -- write your (binary) data to it
    write myList to f
    -- and close the file
    close access f
    Now, separately, you can read it back:
    set x to read (choose file) as list

  • Best way to code a Chat Application

    Hi
    I'm starting a project at work that is going to involve a chat mechanism between 2 parties only. Then the application will be needed to transfer a file, or maybe xml between the 2 clients.
    I'm looking into the various technologies to do this, so does anyone have any hint or ideas.
    Requirements are:
    work project
    run over internet, behind firewalls and proxies
    will only ever be a private chat between 2 parties
    must be able to share files/objects/xml
    secure
    fast reliable etc.
    I decided on an application rather than a website or applet. pointing towards sockets but not sure. also looking at SOAP.
    Any hints ?
    Thanks
    Stevie500

    Why dont you pull your head out?
    The idea (which you seem to have completely missed by an incredibly long way) is give something a go then ask for help. Are you honestly going to tell me you did a google search and thought "that looks like too much effort trying one of these examples, I'll be a troll and get someone to either write it for me or to choose one of the ideas for me cus I'm a bit thick".
    Is thinking "i'm going to write an app instead of an applet" as far as u got? omg.
    If you don't want to start from scratch my suggestion is to do a google search and try one of the examples.
    If you do want to start from scratch then learn about sockets. I wrote my first chat app in a couple of days. I knew java but nothing about sockets when i started. It dosn't take long (assuming you're not a lazy git).

  • What's the best way to transfer music between computers after iTunes Match?

    I've pretty much uploaded everything to iTunes Match now, but my collection is across two computers and so it has merged everything together... Which is fine. However, I was planning on moving some of my items from one computer to another (i.e. from my smaller iTunes Library on the MacBook to the main iTunes Library on my PM G5).
    Since it is all nicely synced now, I've discovered that if I use Home Sharing, then transferring the files manually seems to duplicate them on iTunes Match. So instead of doing this, I'm downloading them from the cloud on my PM and then deleting them on the MacBook once they're done... All good so far. However, a bunch of my music is in ALAC and so I don't want to do it this way because I'll end up downloading the files at 256kbps AAC instead.
    So I just wanted to know, is there a good way of getting already-synced ALAC files from one machine to the other without having to get iTunes Match to re-sync them all over again?

    You can preserve such metadata - worth an initial trial on simply moving as outlined - if metadata is lost you can reinstate by accessing the itunes library .xml file, to force itunes to read it you would need to clear the .itl file (if essential this will work but it is best avoided since it requires iTunes to rebuild your library from the .xml file).

  • Best way to create output with only topics that are not finalized

    I'm nearing the end of a project and I need to isolate the topics that still have questions. I keep trying things, but nothing gives me what I need. Any suggestions? Here's what I tried.
    I'm using RoboHelp 9 (RH9).
    Status
    I can get a report of the topic names and their status using Tools > Reports > Topic Properties and then setting the Options to include only Topic Status, but this isn't useful; that gives me a list of 396 topics, in alphabetical order.
    For each topic, you end up with 3 lines. For example:
    Adding Customers - Adding_Customers.htm
    Status:
    Status: Ready for Review
    I saved the report as TXT and opened it in Word and did a global replace of Status:^p (that is, Status, colon, new line) and then Status, colon, tab. That reduced it to 2 lines for each topic:
    Adding Customers - Adding_Customers.htm
    Ready for Review
    So that's still not very useful. I would have to write a macro or something in either the Word file or once I got it into Excel to concatentate those two lines.
    And even then, I could sort the data and get rid of the lines that show Complete (using an Excel formula), but how would I print out just those topics? If there are only a few, that's no problem, but there are at least 30. (Things changed and topics changed and now some need re-review, and some still have questions.)  Could I make an index out of those lines? No, that would involve a lot of work to write out the XML.
    Okay, so I tried another approach...
    Conditional Text
    I created a duplicate Table of Contents and applied my Questions condition to three topics. I then created a Printed Doc output and specified an Advanced condition saying to include only Questions. That gave me more than the three topics, but not all of the topics. The help says that you can use an Advanced Conditional Build Tag Expressions, and that if you want just those topics with a specific tag ("All topics to which one tag has been applied"), just include that tag.
    BUT it also says: "Topics and topic text to which you have applied no conditional build tag are included in the output."
    So, if I want only those topics to which I've applied a TOC condition of Questions, I need to create another condtion (for example, DONE), and apply that to all the topics that I don't want to print.
    So, assuming I have 30 topics with the condition Questions, I would have to apply my new DONE condition to 366 topics. Yes, I know you can apply a tag to more than one at a time, but I would be wary of doing more than 5-10 at once.
    Still, that looks like the best solution so far. I'm going to back up my project and then start doing that. In the meantime, does anyone have any other way of doing it?
    I'm using RoboHelp 9 (RH9).

    First, no reason to be concerned about applying a tag in the topic list to many topics.
    Before my time the company had an author who wrote in a topic "This is ****" intending to return to it later. He did when a customer phoned asking if the statement was true!
    What I have done is institute a simple method that also helps with reviewing. We add three hash marks ### to any topic at the top or at the point where it is incomplete. We do that using a character style rather than a paragraph so that the text can be within a paragraph. The style is called AuthorComment and we also apply a tag called AuthorComment. Both have a vivid colour applied. EXAMPLE ### Let me know if you have a problem with this.
    When we generate for internal review, we leave that stuff in as it grabs the attention of reviewers so they respond to the comment / question.
    When we generate for external use we add the tag to the build expression but we also do a search of all topics for ### using a third party find and replace tool. TextCrawler for example.
    It's simple and it works beautifully.
    See www.grainge.org for RoboHelp and Authoring tips
    @petergrainge

  • I have ordered the rMBP and will giving my old MBP (2010) to my girlfriend what is the best way to remove the programs and files that she wont use and make it her computer rather than my old one?

    I have no real need to upgrade but as a student the price it would be silly not to.
    I will be giving my MBP to my girlfriend but she wont use a lot of the software on there such as the final cut and CS5 and would rather use the space for her own iTunes library. Some will be kept on though like the old office suite as i have bought the 2011 one as well
    Can I also remove myself as a user on the macbook so the only login is hers? I would rather it was her computer rather than my old one!
    Cheers in advance!
    Kobi

    Hey, man, I'd be excited, too!
    She'll have whichever operating system that came with your computer. Your updates are tied to your Apple ID so if you've purchased updated OS X versions, she'll want to reinstall them using her own Apple ID (yes, it will cost her something but not much).
    Kappy's a know-it-all (and I mean that in the politest of terms) who's a frequent poster here. He has a 'canned' script about how to get your computer ready for resale. I guess he just doesn't have enough points yet to make it an User Tip, but it's a great little rundown of what to do.
    BEFORE you erase everything, I would purchase (if you don't already have one) an external USB hard drive and use Time Machine to backup everything. When you startup your new computer (or afterwards if you just can't wait to see the clean, crisp text in TextEdit) you can use Time Machine to properly migrate all your files, apps and all, onto your new MBPR. If you're not familiar with Time Machine, see  http://pondini.org/TM/FAQ.html. Oh, yeah, since you have Office 2011, you'll need your activation code handy as, for some reason, the activation code does not carry over when you use the Time Machine restore. All Adobe, etc., apps are fine. It's just that damned MS Office that gets you.
    Hopefully Kappy will jump in here. If not just post a message "Kappy: Preparing MBP for resell?" or something to that effect and I'm sure that he'll see it.
    Good luck,
    Clinton

  • How is the best way to give a movie to someone that does not have a mac

    Hi there,
    I would like to give my friend the movie I made that he has to send away for university. What are the options of format to give to him even though he does not have a mac or Imovie.
    Thanks in advance

    Hi
    Most probably as many solutions a users.
    I would
    • Save as QuickTime full Quality .mov - to a DVD - or -
    • Make a plain video-DVD
    QuickTime player is free to download to PC-Window users as well as Mac-users.
    Yours Bengt W

  • What's the best way to reset my MacBook hard drive that's in a disc enclosure to factory settings?

    I have a 2009 MacBook in which the hard drive is currenty in a USB disc enclosure since the MacBook is no longer operational. I want to sell it, but want to reset it to factory settings. How can I do that while it's in the enclosure and connected to my 2009 iMac?
    Thank you!

    If you've got everything you want off of that disk just start Disk Utility on your iMac and erase the disk. Would be wise to take a look at the security options and use a multi pass erase to make sure that none of your data can be mined off of that disc. Be aware that a multi pass erase will take much longer bu is much safer.

Maybe you are looking for

  • IPod Touch (2nd gen) not recognized by computer and iTunes

    When I connect my iPod Touch to my laptop, running Windows 7, neither the computer nor iTunes recognizes my iPod. Everything worked before with Vista. When I plug the iPod into the computer the iPod does turn on put the battery doesn't charge and the

  • RAW plug-ins for Leica V-Lux 4 camera, .RWL files

    I am using Photoshop CS4 on a Mac Pro, OS 10.7.5. I own a Leica V-Lux 2 camera which records RAW files as .RWL files. PS CS4 won't open the  .RWL files even tho Adobe Updater  tells me that I am up-to-date. I can't find anywhere on the Adobe website

  • Help with J2EE SDK 1.4 Virtual Servers please!

    H! Are we doomed to have just one virtual server pointing to port 80?? I have a Win2K computer with J2EE App Server 1.4. In this computer I stopped the IIS 5.0 in order to use the HTTP Server included with the product. I also run the DNS on the same

  • Miss created DIR in Tcode CV02N, CV03N.

    Hi Gurus I've created a DIR in Tcode CV01N. When I press F4 in CV02N, I can't find this DIR. But I can copy Document Number of this to CV02N and I can view/change it. Or I can find it in Tcode CV04N. I use a new Document Type and it is transferred fr

  • PLD & Relate To Issue

    All, I am running 2007 A(8.00.176) SP: 00 PL:35.  I am wanting to display a UDF on Order Item form I created in the BP's Addresses in the Page Header of the PLD form.  I am trying to relate the Ship-To Code to the Business Partner Address.  When I do