QUERYING TWO TABLE BUT not rquired 99% of the time

I have two tables EMPLOYEE AND DEPARTMENT.
Most of the time I require to query only employee table (99% of the time),but there are times when I have to
query department table to get details about department
select e.emp_id,e.emp_age,e.department_desc from employee e,department d where e.department_id = d.deparmemnt_id and e.department_id = 1;
The problem is 99% of the time I dont need the join,that is 99% of the time I jsut need select * from employee because department_id is almost most of the time greater than 1.Wondering how can write just one query that will do the trick.
Thanks
M

this?
SQL> SELECT e.empno,e.ename,CASE WHEN e.DEPTNO=10 THEN
  2             (SELECT d.dname FROM DEPT d WHERE d.DEPTNO=e.DEPTNO) END Depratment_name
  3  FROM EMP  e;
     EMPNO ENAME      DEPRATMENT_NAM
      7369 SMITH
      7499 ALLEN
      7521 WARD
      7566 JONES
      7654 MARTIN
      7698 BLAKE
      7782 CLARK      ACCOUNTING
      7788 SCOTT
      7839 KING       ACCOUNTING
      7844 TURNER
      7876 ADAMS
      7900 JAMES
      7902 FORD
      7934 MILLER     ACCOUNTING
        12 1
       156 1
16 rows selected.

Similar Messages

  • Query Planning enabled - but not able to enter the data

    Hi,
    Created a query which is planning enabled (Check box ticked on Planning Tab in query designer - Start query in change mode checked).
    After execution of the query, if I try to input some plan data, the query is in display mode only. I am not able to input any data.
    Can you please tell me where is going wrong.
    Regards,
    Ravi

    Hi Ravi,
    First of all an input enabled query can only be created on aggregation level.
    As far as your issue is concerned, it seems that your query might not be having
    the required restrictions for the characteristics or are not drilled down.
    Please note that characterictics defined in rows are automatically restricted to a single value , but the same is not the case with the 'Free Characteristic' in the query.
    Please check the restrictions you have made in your query.
    Regards,
    Amit

  • Data exists in DSO New table but not in Active table

    Guys,
    I am loading data from one DSO to another DSO, in my target DSO I have 6 fields which 2 of them are mapped in Transformation and remaining 4 will be populated by Start routine and End routines. Before Activating I am seeing all 6 fields got populated in New data table but after activating I am only seeing the 2 fields in Active data table but not those that are populated through Start and End rouitnes.
    I have only one Key in my DSO, am I missing something here?please let me know.
    Thanks,
    KK

    Hi,
    beside end routine, there will be one icon.
    click on that.
    you will see two options.
    select the option "populate values into fields with out active transformation rules"
    don't remember the words correctly but gives the same meaning...
    Activate the transformation.
    this will solve your problem
    Regards,
    Raghu
    Edited by: Raghu tej harish reddy on May 2, 2009 11:10 PM

  • I am trying to install windows 7 to my Macbook pro with bootcamp but every time I open bootcamp I am only able to check the first two boxes but not the third one saying "install or remove Windows 7", any solutions ?

    Hi, I am trying to install Windows on my MacBook Pro with bootcamp. Every time I open bootcamp I am only able to check the first two boxes but not the third one saying "install or remove Windows 7". I did this before using the same computer and the same hard drive so I am not sure why this is happening now but did´t happen then. Any solutions ?

    Was your Bootcamp info.plist manipulated to change any options?

  • I have three Blue Yeti USB Microphones, and when I try to create an aggregate device in Audio MIDI on my MBP it lets me select two microphones but not the third. I need all three for a podcast, any solutions?

    I have three Blue Yeti USB Microphones, and when I try to create an aggregate device in Audio MIDI on my MBP it lets me select two microphones but not the third. At first I thought maybe the third microphone was just defected or something but I tested the mic individually and it works fine. It'll let me use two Blue Yeti's and another microphone but not three Yeti's at once.

    David Boroditsky wrote:
    The problem is that the mac chokes on having 2 identical mics attached at the same time.
    Ive had 2 identical USB AT2020 mics connected at the same time on both macbook pro and macbook Air.
    The "Yeti" mics, are, lets say undesirable, and low to mid computer consumer mics.

  • I have just signed upfor family sharing. Is there any way you can get the same app on two devices but not have to share it? My sons both want clash of clans but they don't want to be on the same village and they can't both be on app at the same time?

    I have just signed up for family sharing. Is there any way you can get the same app on two devices but not have to share it? My sons both want clash of clans but they don't want to be on the same village and they can't both be on app at the same time?

    hi, the app is not "shared", it works as if you bought the app twice with different accounts, only you paid it once. they should have 2 different villages since they're on 2 different devices.

  • Query two tables in two different databases.

    Hello,
    I have to query two tables say 'a' in database "D1"and 'b' in database "D2".I am using sql developer and it is accepting only querying for repecting databases.
    i.e if i would like to access b from the sql script of D1 .Please guide me in this regard.
    thank you.

    Create a database link in DB "a" pointing to DB "b" then use the db link in your script.
    Message was edited by:
    skutz

  • HT5105 I have been trying to create a multicam clip from two camera's. They sync properly when using the sync feature but not when I use the multicam feature does anyone know what I may be doing wrong?

    I have been trying to create a multicam clip from two camera's. They sync properly when using the sync feature but not when I use the multicam feature does anyone know what I may be doing wrong?

    Probably best if you could post screen shots of the Inspecror window in extended view with a couple of the clips you using for the 2 angles.
    If you have audio from both cameras and have identified them separately, the sync is usually pretty reliable.
    Russ

  • Downloaded songs show on two ipods but not the third in home share

    I've downloaded a song and it shows up on two devices, but not on the third.  Does anyone know why this might happen and how to move it to the third device?

    Welcome to the Apple Community.
    The first thing that comes to mind, is that on the third device, you do not have the option at settings> music> automatic downloads checked.

  • I can't connect to my school's free wifi. i was able to do it before but not anymore i get the self assign ip agrees message .it has no password only a pop up window before you connect to agree to school terms for wifi use. i don't get that window anymore

    I can't connect to my school's free wifi. i was able to do it before but not anymore i get the self assign ip addrees message .it has no password only a pop up window before you connect to agree to school terms for wifi use. i don't get that window anymore. i tried everything I can think of. It is a 2010 macbook pro but i recentrly updated to osx lion and even with lion it was working fine so I nkow it is not the update. also Im able to connect to other internets at home it works great. starbucks too.  but i became so frustated that i reset my computer to manufactuter setting and reinstall snow leopard on it. still I cant connect. I need help please i have been searching all over the web for help and i see people has been having this same problem for years now.. oh yeah and i know it is not the internet cuz there are other macs connecting to it without a single problem so i think it is an isolated problem plase help....i have follow many advises such as delete the internet from your prefered netwoks. restar your commputer etc etc.

    Be sure Safari does not have the Block Pop-Up Windows preference set.
    Where I work now there are several unencrypted VLANs that require authentication, and Safari promptly pops up a window for me to register every time.

  • My iPad only has sound when the earphones are plugged in. The switch that controls the volume works then, but not when I take the earphones out. Suggestions?

    My iPad2 only has sound when the earphones are plugged in. The volume switch works then too, but not when I take the earphones out. Suggestions?

    it's a hardware issue
    https://discussions.apple.com/thread/1343532?start=315&tstart=0
    more here
    iphone stuck in headset mode

  • HT204053 I have tried to load iCloud onto my Vista opperated pc but do not get a control panel with which to set it up. Each time I use my iTunes id to log into the iCloudI am told that it is an apple id but not set up for the Cloud. How do I get the cont

    I have tried to install iCloud on to my Windows Vista pc. No control panel is present and when I try to login to iCloud using my iTunes id, I am told that it is an Apple id but not set up for the cloud. without the control panel where do I set up my iCloud id?

    You can not setup a new iCloud account using a PC. You must use an Apple device (Mac or iPhone/iPad) to create the account, then sign into it using your PC.

  • I can import some songs from another computer but not others.  All the songs were purchased with the same apple id. Message says "...check connection to network..." Any ideas as to what could be causing this problem?

    Using home share, I can import some songs from my son's  computer but not others.  All the songs were purchased with the same apple id.  Err msg:"There was a problem downloading ... You do not have enouggh access privileges for this operation. Please check that the connection to the network is active and try again."  The network appears to be fine .  I can import other songs from his library.  The same songs cause me a problem each time I try.  My husband had no trouble importing the same songs I have trouble with. I get the same error message if I try to import the same songs from my husbands computer as well.  "Command I" appears to show the same protections on both the songs I can import & the ones I cannot.  My husband and son are both running OS 10.6, while I am running 10.7.  I think I had this problem even before I upgraded, but I am not certain.

    x0SiN0x:
    Welcome to Apple Discussions..
    My first suggestion is to Repair Disk. Here's how:
    Insert Installer disk and Restart, holding down the "C" key.
    Go to Installer menu (Panther and earlier) or Utilities menu (Tiger) and launch Disk Utility.
    Select your HDD (manufacturer ID) in the left panel.
    Select First Aid in the Main panel.
    (Check S.M.A.R.T Status of HDD at the bottom of right panel, and report)
    Click Repair Disk on the bottom right.
    If DU reports disk does not need repairs quit DU and restart.
    If DU reports errors Repair again and again until DU reports disk is repaired.
    If DU reports errors it cannot repair you will need to use a utility like Tech Tool Pro or Disk Warrior
    Please post back and let me know how that goes.
    Here are a few links that may help you to identify the issues:
    Resolving Disk, Permission, and Cache Corruption
    Tuning Mac OS X Performance
    Mac OS X System Maintenance
    Please don't hesitate to post back should you have further questions or comments, or with update.
    Good luck.
    cornelius

  • My itunes account was disabled for some reason.  I changed password in iforgot and still didn't work.  I could log in but not make purchases from the store so I set up a new login/account .  Is there any way to move my music to the new account?

    My itunes account was disabled for some reason.  I changed password in iforgot and still didn't work.  I could log in and see my music but not make purchases from the store or even redeem an itunes gift card so I set up a new login/account with another email account of mine. On the new account I can redeem my gift card and download items onto my ipad2.  Is there any way to move my music to the new account?

    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    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. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Click the Clear Display icon in the toolbar. Then try the action that you're having trouble with again. Select any messages that appear in the Console window. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message (command-V).
    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 this discussion.
    Important: Some private information, such as your name, may appear in the log. Anonymize before posting.

  • My iphone is activated in my computer but not on iphone whats the next step

    my iphone is activated in my computer but not on iphone whats the next step

    It sounds to me like you either got defective parts or otherwise did not make the repair correctly. We cannot help  with self-repairs here, the iPhone officially not user servicable, but you can ask for advice in the forums on ifixit.com, a site which is dedicated to those attempting their own repairs.
    Regards.

Maybe you are looking for

  • Hacked and email changed!

    Hello,     My account got hacked today, and someone charged $70 to my credit card! What make it worse is that they changed the primary email address then changed my password. So now:     * I can't change the primary email, because I don't have the pa

  • Attachment with Soap

    We have a scenario where Soap message will be sent with attachments.We are not sure of how to handle attachments in XI through Soap Adapter. Any pointer will be of great help!! Samir

  • Keeps telling me to download adobe flash player and its already downloaded

    i am new to the MacBook Air.  I downloaded a game from the apps store.  Whenever I try to play, it keeps telling me to download the Adobe Flash Player and its already downloaded and is up to date. 

  • Database Migration -- MaxDB to Oracle

    Hello, We are planning to migrate our XI 7.0 server from MaxDB to Oracle... I am currently reading the System Copy Documentation from SAP... Has anyone done MaxDb --> Oracle Heterogenous Copy.... Any Input, Guidelines & Strategies will be appreciated

  • IPad syncing problems

    Hi, in the last couple of iTunes versions (currently on 10.2.2), when syncing iPad (first version), i get two messages pop up...... 1. iTunes could not back up the iPad "name of ipad" because an error occurred. 2. iTunes could not backup as there is