Turning an N:N join into several 1:N?

I have one table/folder containing the following items:
activity_id, industry_id, and product_id.
I have another table containing the values (e.g. description of the activity, description of the industry and description of the product) of the id's. The columns in this table are pid, id, and description. In other words: the description of activity, industry and product is kept in the same column. The pid tells whether the column reflects activity, industry or product. So by example I have the following rows:
pid, id, description
2, 3, Business Work
2, 4, Leave
3, 5, Software Industry
3, 7, Manufacturing
4, 9, Large Shoes
4, 10, Small Shoes
So rows 1-2 is about activities, rows 3-4 is about industry, and rows 5-6 is about products.
I want the joins to look up the description, but how do I establish the join?
The activity_id should join with the rows that contain
2,3, Business Work
2,4, Leave
and the industry_id should join with the rows that contain
3, 5, Software Industry
3, 7, Manufacturing
and the product_id should join with the rows that contain
4,9, Large Shoes
4,10 Small Shoes
Thanks

You could try to type this:
select pid,id,description from table1 left join table2 on (table1.activity_id=table2.activity_id) and (table1.industry_id=table2.industry_id)
and (table1.product_id=table2.product_id);
Table1 is the table where activity_id,industry_id and product_id is saved. This table must be the master.The second table is where the values are saved and must be the detail table.
Hope this helps.

Similar Messages

  • How do I turn a long page into several

    I used a blank templet page to copy some text to. How do I turn this one long page into several with the 2 3 > next to cut download time

    Is there another way. This one puts to many pages in the site menu. On photo pages you can limit the # of photos per page and the programs makes additional pages that are numbered but don't appear on the site menu. Like when you are reading a long news article and it has multiple pages.

  • Lion 10.7.2 On both mac book pro and iMac, both with Lion 10.7.2, obtain repeated iCal event notifications from calendar or address book.  Cannot turn these off.  They repeat several times per session and every time computer is used.  How to diagnose this

    Lion 10.7.2 On both mac book pro and iMac, both with Lion 10.7.2, obtain repeated iCal event notifications from calendar or address book.  Cannot turn these off.  They repeat several times per session and every time computer is used.  How to diagnose this?

    First, uninstall "SuperTV" (whatever that is) according to the developer's instructions. It isn't working and it's filling the log with noise.
    If you have more than one user account, these instructions must be carried out as an administrator.
    Launch the Console application.
    Step 1
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left.
    Enter "BOOT_TIME" (without the quotes) in the search box. Note the timestamps of those log messages, which refer to the times when the system was booted. Now clear the search box and scroll back in the log to the last boot time when you had the problem. Post the messages logged before the boot, while the system was unresponsive or was failing to shut down. Please include the BOOT_TIME message at the end of the log extract.
    Post the log text, please, not a screenshot. If there are runs of repeated messages, post only one example of each. Don’t post many repetitions of the same message. When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    PLEASE DO NOT INDISCRIMINATELY DUMP THOUSANDS OF LINES FROM THE LOG INTO A MESSAGE. If you do that, I will not respond.
    Important: Some private information, such as your name, may appear in the log. Edit it out by search-and-replace in a text editor before posting.
    Step 2
    Still in Console, look under System Diagnostic Reports for crash or panic logs, and post the most recent one, if any. In the interest of privacy, I suggest you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if present (it may not be.) Please don’t post shutdownStall, spin, or hang logs — they're very long and not helpful.

  • How to break a bitmap into several movie clips

    Hello,
    I have a bitmap imported into library and need to break it
    with ActionScript2.0 into several bitmaps, using a rectangular
    grid. The smaller bitmaps have to become movie clips so they can be
    animated further.
    The resulting animation should be: bitmapped picture breaks
    into tiles which fly away...
    Possible? Thanks for help

    quote:
    Originally posted by:
    patrick garner
    I'm not sure what you mean... You want to break it apart with
    actionscript?
    Yes, I want to have an image and break it into tiles at
    runtime using AS2.0. Each tile should become a MovieClip so that I
    can add some simple code for random movement for each tile. That
    way they'll fly away. (later I want to make modifications to make
    an opposite effect - tiles fly randomly until they make up a
    picture again, or there's room for a bunch of other effects...)
    quote:
    You do Contol > B and break it apart that way and turn
    them into MCs. Then add tween classes to each of the pieces to make
    them move.
    Thanks but that's not it...

  • How can I turn my French apple account into Australian one to be able to buy a Iphoto book I've made?

    hi
    How can I turn my french apple account into an Australian one , to be able to buy a Iphoto book I 've created ?

    And you need to set the "Print Products Store" in the iPhoto Preferences "Advanced" to the country you are in. The credit card you will be using with your AppleID needs to be valid in the country your AppleID is registered to. Will you be staying permanently in Australia? Maybe it wuld be simpler to create a second AppleID just for the time of your stay there.

  • How do you turn third-party midi loops into Apple Loops?

    Does anyone know how to turn third-party midi loops into Apple Loops? I've got hundreds of short midi files that I purchased, and I would like to be able to use them in the loop browser of Logic Studio. I tried some of the obvious ways of doing this, like using Apple Loop Utility, but it doesn't seem to recognize .mid files. Seems like .mid files would be right up its alley, so maybe I'm doing something wrong...

    Yes, have the same problem but with wav loops. i have 75000 wav loops from third part and do not find how to "logicized" it. For the moment i can use them into a project but they are not adapting when i change the bpm of the projetc for exemple.
    If you know the solution i would be rescued

  • How can I turn my Mac using iTunes into an alarm clock?

    Here's my question: How can I turn my Mac, using iTunes, into an alarm clock?
    I want to be able to put my Mac to sleep but have it set up so that when it wakes up at the predetermined time iTunes will open and start playing the music I've selected....
    A "musical alarm clock"...
    A friend suggested using the Energy Saver option in Sys. Preferences to wake the computer at the right time. He said that then I could use iCal to start iTunes. I would then have to use an Apple Script to get iTunes to play the song I want.
    But is there a SIMPLER way to do this? Are there any programs out there that do this already??
    Thanks for any help....

    I recently got a copy of AlarmClock Pro from MacWorld UK. It is shareware, I think it is (USD?)19. I haven't had a chance to try it out much, but it does look quite good. I have an older version. The latest version looks even better.
    I'm sure there's plenty of freeware apps out there. You might also want to try looking here for an applescript here Doug's AppleScripts for iTunes
    p53

  • When I send an SMS message from my Text Message Forwarding enabled Macbook to an Android, it breaks the message up into several out of order chunks. Is there a solution to this?

    I have a 2012 Macbook Air and an iPhone 5, both with up-to-date software. When I set up Text Message Forwarding, everything went according to plan, until I sent a relatively wordy text to a friend (from my Macbook) to a friend on an Android phone. It chopped the text up into several 2 line fragments, and delivered them in seemingly random order. The fragments were specifically 2 lines, and not 160 characters, which is the "limit" you used to get on old SMS messages. It continues to happen.

    Are you using any emoji, or accented characters? If so, try not to. Also, I recall something about a double space at the very end of the text. Unfortunately, I don't remember if you should use them or avoid them.. Beyond that, there's not much you can do. How the text is delivered is under control of the carrier.

  • Split a Shipment costs document into several MM document by carrier

    Hi gurus,
    I am trying to split a Shipment costs document into several MM document by carrier. We need the system to search for an existing MM order if not found create a new one (the system is set to do it by V_TVFT-BESER value “A”).
    I have a route with different stages. These stages/steps have associated different carriers (or partners).
    When these data is transferred to MM purchase order the system gives an error with the message no. M7107:
    Enter goods receipts for vendor 103962 only
    Message no. M7107
    The system does the purchase orders but not the 101 movement.
    Does someone met this problem before?
    I am in 700 SAP version with package 12
    Regards.
    Mikel

    Hi,
    Check out BADI BADI_SCD_PO_SELECT. This allows you to control which purchase order is used for shipment costing.

  • How can I break one track into several tracks

    Hello all,
    Im new to Mac and garageband, My problem is when i spin a full set of lets say 2 hours into garage band as 1 track, how can I go back and break that 1 track into several tracks so when I make a cd people can change from track to track instead of listening to one track all the way through.
    Thanks in Advance

    Ok now that I chose the region how would I export it?
    Just select "export".
    And Also Do I have to export each track one by one to itunes?
    Since you want to burn a CD, you need several sound files, and GB only exports one file at a time.

  • Breaking one track into several fluidly

    I did a live recording all into one instrument track using the internal microphone on my Macbook. It sounds great, but I'm wanting to produce a CD from it and track each song individually.
    My problem, when I segment the show with garageband and then export each song to itunes, (and yes I was very careful to cut at the exact to the hundredth of a second)there is a 2-3 second pause at the end of of each track while it shows the meter still moving.
    I want the entire CD to play as if the listener was sitting there at the show, with the added advantage of being able to skip to the 6th song if they desire.
    Thanks to anyone who can help me out!
    -Ace
    Message was edited by: AceWheeler

    I'm having the same problem, so how did you solve your issue. I spin a 1 hour set into garageband as 1 track and I want to go back and break it up into several tracks. I went to the other link but i'm new to mac so i didnt understand how to do it.

  • Invoice A/R Payment Split Transaction into Several GL Accounts

    Hi,
    I got following message from SAP Support:
    The SplitTransaction property is not included in product develop plan by now.
    By SAP Note 1028874, we would like to ask you to post your requirement in our SAP Business One Product Development Collaboration forum and not via message:
    /community [original link is broken]
    Please refer to Note 1028874 for more information.
    ISSUE
    Sample 2, Bank transaction:
    I have build a Payment routine in Invoice A/R.
    I am doing a Bank transfer in Payments regarding payment with Interact (direct Payment from Bank
    account)
    Here in Canada you have the possibility to withdraw money: Sample invoice cost $100, you can pay
    $200 and receive $100 in cash.
    Sample I like to do:
    GL Account A $200 (Account Number, Debit )
    GL Account B $100 (Account Number, Credit)
    GL Account C $100 (Business Partner, Credit)
    Any suggestion?
    In the Payment describtion I can do a  vPay.SplitTransaction = 0; but this is not working according to SAP Support.
    SUMMARY
    I like to do a payment and Split the Transaction into several accounts; like Journal Entry with reconciliation of the Journal Entry and the Invoice.
    Thank you,
    Rune

    Hi Peter,
    I do not want you to promote the future code; but the code in SDK as today.
    Sample, it would look something like the code below from SDK help code; but please change the code to work as your sample.
    Thank you,
    Rune
    vPay.Invoices.AppliedFC = 0
    vPay.Invoices.AppliedSys = 0
    vPay.Invoices.DocEntry = 8
    vPay.Invoices.DocLine = 0
    vPay.Invoices.DocRate = 0
    vPay.Invoices.InvoiceType = 13
    vPay.Invoices.LineNum = 0
    vPay.Invoices.SumApplied = 5031.2
    Call vPay.Invoices.Add
    vPay.CardCode = vmp_CardCode_string;
    vPay.DocDate = DateTime.Now;
    vPay.JournalRemarks = "Incoming - Payment Bank Transfer";
    vPay.TaxDate = DateTime.Now;
    vPay.TransferAccount = vmp_BankAccount_string;// "_SYS00000000343";
    vPay.TransferDate = DateTime.Now;
    vPay.TransferReference = vmp_CardCode_string;
    vPay.TransferSum = vmp_Amount_double;
    vc_Message_Result_Int32 = vPay.Add();

  • Source code organization: How to divide large JavaScript files into several smaller JavaScript files?

    Hello,
    some of my JavaScripts have become considerably large over time. What I would like to do is to split a single (large) JavaScript source file into several smaller source files plus an additional JavaScript file containing code or directives to recombine the split files.
    In other words, I would like to organize my JavaScript source code into re-usable modules.
    Although I searched the Acrobat JavaScript developer documentation and did a lot of Web searching, I still have no idea...
    whether the Acrobat JavaScript scripting environment itself does provide a code structuring mechanism
    how to properly organize large Acrobat JavaScripts in general.
    Any help would be greatly appreciated! Thanks a lot in advance!
    Sebastian

    Document-level scripts are not accessible to other documents/scripts, so they're not a good option.
    Folder-level scripts, on the other hand, are accessible to all other documents/scripts. So if you have a general function that creates a 3D annotation, for example, you can place it in a folder-level script and then call it from other scripts (you will probably need to provide it a handle for the document and properties of the annotation).
    One thing to be aware of, though, is that the folder-level scripts are loaded alphabetically, so don't put a reference in script aaa.js to something that loads in zzz.js, or you will get an error message when you open Acrobat. (this is not a problem if zzz.js is not called during the launch of Acrobat)

  • My iphone 4 only turns on when its plugged into a wall and when it finally turns on it lasts for about a minute then it turns off and while its on the signal says searching, what should i do?

    my iphone 4 only turns on when its plugged into a wall and when it finally turns on it lasts for about a minute then it turns off and while its on the signal says searching, what should i do?

    Try:
    - Reset the iOS device. Nothing will be lost
    Reset iOS device: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings      
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup. See:                                 
    iOS: How to back up                                                                
    - Restore to factory settings/new iOS device.      
    If still problem, make an appointment at the Genius Bar of an Apple store since it appears you have a hardware problem. You likely have a bad battery.
    Apple Retail Store - Genius Bar                       
    Apple will exchange your iPod for a refurbished one with a new battery for $79. They do not fix yours.
    Apple - iPod Repair price                       
    A third-party place like the following will replace yur battery for less. Google for more.
    iPhone Repair, Service & Parts: iPod Touch, iPad, MacBook Pro Screens
    Replace the battery yourself if you are up to it. A replacement costs about $10
    iPod Touch Repair – iFixit

  • My iPhone turns off whenever it goes into standby mode and has to be turned back on to work

    My iPhone turns off whenever it goes into standby mode and has to be turned back on to work

    That's normal behavior. It turns off automatically in order to preserve the battery. Pushing the On/Off button turns it on immediately. This also requires entering the passcode and prevents the phone from being accessed by anyone but you.

Maybe you are looking for

  • How to use the static lib of berkeleydb in VC6?

    I know there is a libdb45s.lib. But when I try to link my project to it, VC6 reports many errors. Even the getting start examples cannot link correctly. The documents coming with berkeley db do not tell me how to link project to the lib, no matter st

  • HP ENVY TouchSmart m7t-j000 Notebook PC - Adding a second hard drive

    Product Number:  E4S80AV I'm having a hard time finding a SATA III cable and caddy for a second hard drive for my laptop.  Any ideas?  Right now, I just have an extra 1.8 inch drive I can't use. Robert

  • Approved RMA but status is Pending

    Hi, I enabled the iStore Return process with Approval. I created one RMA order and Approved by an approver, but the RMA order status still Internal Pending Approval. How to change the order status to Booked at Header level now Internal Pending Approv

  • PCUI Support for BP-Type

    Dear Experts, In our project (CRM2004) we can distinguish two type of business partners: - Prospects - Customers Prospects may be changed by every person while for customers only a limited number of fields may changed in CRM (like e-mail address) all

  • Separate 2 Channels in SoundInputRead.vi

    Hi , I would like to distinguish between 2 Channels that I am reading out from the SoundInputReadvi. I can see that both are read but when I draw them using a graph, it seems that they are interpolated between each other. The index in the picture sho