Select with case statement and a formula of the IIR

Hi, I was looking to get help regarding a statement writing box with a statement select statement all. I tried to reproduce a formula IIf access well that just wanted to check that the query I wrote is correct, any advice would be appreciated.

[code]

Select *.

Of

(

Select name, month, duration, volume, time_spent, date1, date2,.

-case when 'date' > = 'date1' then '1' other '0' end as departure,.

-case when 'date' < = "date2" then '1' other '0' as end ending

Of

(

Select *.

of call_1 cd

inner join call_2 ON cd.name = cl.queue cl

)

)

;

[/ code]

I want to know is where I have my ' select name, etc, I would change that to select * to make it easier instead of typing all the field_names outside, but I don't know how to do and also what follows is 2 IIF formulas from an access database for the start of the final case statements so I just wanted check I wrote it correctly.

[code]

departure: IIf ([date] > = [date1], 1, 0)

[/ code]

[code]

ending: IIf ([date] < = [date2], 1, 0)

[/ code]

Any advice would be appreciated.

Hello

Whenever you have any questions, post a small example of data (CREATE TABLE and only relevant columns, INSERT statements) for all of the tables involved and the results desired from these data.
Explain, using specific examples, how you get these results from these data.

If the output depends on what anyone outside the application itself (for example, when it is run) and then include a few different examples and the results you want of each given the same sample data. For example, "if I run on November 19, 2013, while the results should be... because... but if I run between November 21 and November 27, then the results should be... because...". »
Always say what version of Oracle you are using (for example, 11.2.0.2.0).

See the FAQ forum: https://forums.oracle.com/message/9362002

318f20b8-a3d0-4FB4-bb0f-73785250b7d4 wrote:

Hi, I was looking to get help regarding a statement writing box with a statement select statement all. I tried to reproduce a formula IIf access well that just wanted to check that the query I wrote is correct, any advice would be appreciated.

[code]

Select *.

Of

(

Select name, month, duration, volume, time_spent, date1, date2,.

-case when 'date' > = 'date1' then '1' other '0' end as departure,.

-case when "date."<= 'date2'="" then="" '1'="" else="" '0'="" end="" as="">

Of

(

Select *.

of call_1 cd

inner join call_2 ON cd.name = cl.queue cl

)

)

;

[/ code]

I want to know is where I have my ' select name, etc, I would change that to select * to make it easier instead of typing all the field_names outside, but I don't know how to do and also what follows is 2 IIF formulas from an access database for the start of the final case statements so I just wanted check I wrote it correctly.

[code]

departure: IIf([date]>=[date1],1,0)

[/ code]

[code]

ending: IIf ([date]<>

[/ code]

Any advice would be appreciated.

DATE is not a function of Oracle; in fact, it's a terrible name for a column or function, because it blends with the DATE data type.

In Oracle, the function SYSDATE returns the date and time, according to the clock on the database server.  So, SYSDATE can return a value as November 19, 2013 06:33:15.   If you want to midnight the same day (i.e., November 19, 2013 00:00:00) and then use TRUNC (SYSDATE).

String literals (for example the string which consists 5 characters d, a, t, e, and 1) go inside the single quotes. Numbers and the names of columns only.

If you want to include all the columns, more some calculated values, in a SELECT clause, then you must use a name table or alias before the *.  (See select_2 below.  To do this, assign the alias j to display online.)

Maybe you wanted to say something like:

Select *-it's select_1

de)

Select j. *-it's select_2

, case when SYSDATE > = date1 then 1 or 0 end as departure

, case when SYSDATE<= date2="" then="" 1="" else="" 0="" end="" as="">

de)

Select *-it's select_3

of call_1 cd

inner join call_2 ON cd.name = cl.queue cl

) j

)

;

As mentioned in a previous answer, you should be careful about the use of "SELECT *" in production code.

In select_3, it would be better if you explicitly listed the columns you need.  It can improve efficiency and maintenance.  In this request, queue and the name will be always the same, so you probably don't want to include both of them in the result set, in any case.

In select_1 and select_2, it is acceptable to use "SELECT *", assuming that select_3 is fixed.

Moreover, there is no point in using subqueries here.  You can get the same results simply in a single query, without any subqueries.

Tags: Database

Similar Questions

  • Problem with Case statement

    I try to use a case statement in a report of the Apex, but I get an error message.

    It comes to my sql

    CASE WHEN EXISTS (select stg.extkey, distsubtrpgrpid

    of udm_da da

    udm_di di

    udm_distsubtrpgrp stg

    where di.disttransgrpid = stg.disttransgrpid

    and da.daid = di.daid

    and da.suid = su.suid)

    THEN

    Select stg.extkey

    of udm_da da.

    udm_di di,

    udm_distsubtrpgrp stg

    where di.disttransgrpid = stg.disttransgrpid

    and da.daid = di.daid

    and da.suid = ' | Qul SUID. '

    Stg.extkey group, distsubtrpgrpid

    Union

    Select stg.extkey

    of stg udm_distsubtrpgrp

    where distsubtrpgrpid! = - 1

    and distsubtrpgrpid = ' | NVL (su.distsubtrpgrpid-1). '

    order by 1

    WHEN su.distsubtrpgrpid IS NOT NULL

    THEN

    Select stg.extkey, distsubtrpgrpid

    of stg udm_distsubtrpgrp

    where distsubtrpgrpid! = - 1

    and distsubtrpgrpid = ' | NVL (su.distsubtrpgrpid-1). '

    order by 1

    ON THE OTHER

    NULL VALUE

    END DISTSUBTRPGRP_1

    Any help appreciated

    Gus

    GusC wrote:

    Yes you are right.

    My sql must be

    CASE WHEN su.distsubtrpgrpid IS NOT NULL

    THEN

    Select stg.extkey, distsubtrpgrpid

    of stg udm_distsubtrpgrp

    where distsubtrpgrpid! = - 1

    and distsubtrpgrpid = su.distsubtrpgrpid

    ON THE OTHER

    NULL VALUE

    END DISTSUBTRPGRP_1

    But the report won't save

    Gus

    No, your SQL is not that.

    The select statement that you put online here, aside from being not not in brackets, is the selection of two values, but you can provide two values for the result column.

    Without knowing who the SQL statement, we can highlight only the obvious questions.

  • Problem with CASE statements

    Hi all

    I have a calculation in a report of Discoverer Desktop with 29 instructions BOX and still 2 case statements more to add. The problem is that my report freezes and fails to run due to the excessive number of case statements. I need to put the 31 statemnts cases in the report, how do I do this? Is there another way to do it without causing the report to freeze?

    Below is part of my instructions box just to show you what I'm doing:

    CASE WHEN Ex = 'MM' AND THEN of OTHER NULL result (', ')
    CASES WHERE Ex = "PP" AND result IN (40,35,30,25) THEN NULL OTHERWISE
    CASE WHEN Ex = he's ' AND result IN (' a ',' B', 'C', d ') THEN NULL OTHERWISE
    -CASE WHEN Ex = 'IO' AND THEN of OTHER NULL result ('Distinction', 'Merit')
    -CASE WHEN Ex IN ('ZZ', 'WW', 'SS', 'KK') AND ('PASS', 'P') THEN to ANOTHER NULL result...

    The last statement should be BOX WHEN... THEN NULL OTHERWISE 1 END END END END...

    Help, please. Thank you.

    Hello
    You have reached the limit of characters in a calculation.

    Try to set into a single statement as follows:

    CASE WHEN Ex = 'MM' AND THEN of OTHER NULL result (', ')
    WHEN Ex = "PP" AND as a result (40,35,30,25) THEN NULL OTHERWISE
    WHEN Ex = he's ' AND result IN (' a ',' B', 'C', d ') THEN NULL OTHERWISE
    WHEN Ex = 'IO' AND THEN of OTHER NULL result ('Distinction', 'Merit')
    WHEN Ex IN ('ZZ', 'WW', 'SS', 'KK') AND ('PASS', 'P') THEN to ANOTHER NULL result...

    The last statement should be BOX WHEN... THEN NULL OTHERWISE 1 END

    Another option is to combine all the statements of NULL in a series of gold options like this:

    BOX WHEN
    (Ex = 'MM' AND the result in (', am')) OR
    (Ex = "PP" AND result IN (40,35,30,25)) OR
    (Ex = he's ' AND translated BY (' a ',' B', 'C', ')) OR
    (Ex = 'IO' AND as a result ('Distinction', "according to merit")) OR
    (Ex IN ("ZZ", "WW", "SS", "KK") AND result IN ('PASS', 'P')) THEN ANOTHER NULL...

    Best wishes
    Michael

  • I was on YouTube with my helmet and then I unplugged the and plugged them back and now I don't got no noise at all.

    I was online on you tube with my headphones and then I unplugged the and plugged them back and now I had no noise at all, what can I do? I checked the audio Manager and it seems fine.

    Hello

    (1) you use Internet Explorer or another browser to go online?

    (2) this happens on all websites and pages?

    (3) other sounds work fine on the computer?

    (4) may I know the operating system you are using?

    (5) were there any changes before the show?

    I suggest you to follow the steps mentioned below and check if it helps.

    Method 1: No sound in Windows.

    http://Windows.Microsoft.com/en-us/Windows/help/no-sound-in-Windows

    Method 2:

    Check the playback settings to see if the device is turned off / disconnected.

    Method 3: If you are using Internet Explorer, check if this option is enabled.

    a. Click Start, type "inetcpl.cpl" and press to enter.

    b. click on the Advanced tab.

    c. scroll down to see the multimedia section and make sure that "play sounds in Web pages" option is selected.

    d. click ok to apply the changes and see if the problem still occurs.

    Restart Internet Explorer and check if you can hear the noise.

    You can also try to update flash player on your computer and check if the problem is resolved.

    For more information, see the link:

    http://Windows.Microsoft.com/en-us/Windows-Vista/tips-for-fixing-common-sound-problems

    I hope the information is useful!

  • windows vista 64-bit vista need upgrade Express dvd, but can't without a yellow sticker? is - this saposed to be somewhere on my pc? or on the vista cd case? and how to make the upgrade without the sticker? __

    need vista in windows vista 64-bit upgrade Express dvd, but can't without a yellow sticker? is - this saposed to be somewhere on my pc? or on the vista cd case? and how to make the upgrade without the sticker?

    32-bit to 64-bit is NOT an upgrade path.

    It must be done with a clean installation using a Vista FULL 64-bit disk/license.

    Buy a version of disk/license FULL Vista 64 bits of your local computer, or online store: amazon, newegg, etc.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    If you already have a version of Vista Home 64 bit, here's how to buy Vista 64 bit Ultimate Anytime Upgrade:

    http://www.Microsoft.com/Windows/Windows-Vista/get/Anytime-Upgrade-overview.aspx

    See you soon. Mick Murphy - Microsoft partner

  • All-in-one HP Officejet 7300/7400 series, it will work with Windows 7 and how to get the OCR software work?

    I have a HP Officejet 7300/7400 series all-in-one, it will work with Windows 7 and how to get the OCR software work?

    By installing complete software functionality of the HP cd or online installation and connection of the printer only when the installation says too much

    http://h10025.www1.HP.com/ewfrf/wc/softwareCategory?OS=4062&LC=en&cc=UK&DLC=en&sw_lang=&product=391182#n193

  • I have problem with Muse files when you work at home with my laptop and when I open the files again in my work with my IMac.

    I have problem with Muse files when you work at home with my laptop and when I open the files again in my work with my IMac.

    I do: when I am uncomfortable with the laptop I save the files on the laptop, then on my external hard drive. Then, when I'm at work, I opened the drive, but the Muse says every time, that so many links in the 'active' is missing. And it takes a lot of time to get all the missing link. Like today I had to open a file of Muse from the external hard drive, and there are about 100 links that are missing.

    How can I solve this problem

    the best thing if you are a user of creative cloud is to store the files in a folder in your account of cloud instead of transferring the files from one computer to another.

    If you are not a Subscriber cc then Dropbox or iCloud will work as well.

  • Object with several States and slider in the "folio" are pixelated, settings seem correct.

    I can't keep an object with several States to be rasterized text, as well as a slider which is also dithering.

    I read that you are supposed to adjust the folio, and article up to be .pdf and the cursor should have the possibility of vector chosen.

    I have not found anything to object state multi for these parameters.

    What happens is when I exit the folio to Adobe Content Viewer, only the text of these items is rasterized. All other texts to be crispy. Tested on Mini iPad and iPad retina and both are blurred.

    Is there a way to force the vector option? It seems even with the selected options it is still screening test in interactive elements.

    Thank you!

    I don't know if I missed something, but it seems to work now. Maybe the v26 option (I deleted the old folio and recreated, and it works as expected now.)

    Can you send me a link to information about the scrolling content and the position of the document? The method I used the frame was from an article of Adobe, although it could be old.

    Thanks for your help!

  • yet cs6 chapter selection with remote control and button title


    Good evening... I imported links Dynamics throug a sequenco to still cs6. There are already some chapters, but if I press preview and I click Start film is not skip to the next chapter... No preview... I can skip chapters only if I start to see the movie from a chapter (2-5-7 is not important the number) in scene selection menu... could you tell me how I can solve this problem? Thank you... and to play on the menu... If I want to return to the main menu, once the movie started, he returned to the scene selection menu, not to the main menu... could you tell me what can do to solve these problems? Thank you so much everyone

    Please post a screenshot of your chart again.

  • Shuttle with cascade LOV and pre-populating on the right side

    Good afternoon

    In my form, I have a piece of text to a certain number of tickets, a drop-down list for a site and a shuttle service to the employees of the site.  If I select a site in the drop-down list, the shuttle refreshes and I can choose employees.

    Here's the wrinkle, if I get a ticket number, it triggers a dynamic action to pick up the site and all selected employees.  I checked the values returned and the dynamic action works as expected.  When the site is updated, the shuttle refreshes, but the selected employees are not load in the right side of the shuttle.

    I tried to divide the dynamic action of the number of the ticket into two pieces: one to select the site and the other to select the selected employees.  In the hope that the dynamic actions would be the fire of the order of the site, refresh the shuttle and update the selected employees. But I don't always get the right side of the shuttle, populated.  I tried the process a few times with debug and dynamic actions do not always work in the right order, and when they do, the right is not be filled.

    I know that the right side of the shuttle can be loaded, but the dynamic action on the ticket number also retrieves the values for another shuttle this shuttle is based on a static select statement.

    Any ideas on how to get the right side of the shuttle completed when the selection is based on a LOV cascading?

    Another idea, is possible to launch a dynamic action when the left side of the shuttle is filled.  Then I could store employees selected in a temporary variable and load them after the shuttle is filled.

    Thank you

    Ray Gillfillan

    I solved my problem.

    I added a variable temp for action dynamic ticket number for the value to be set on the right side of the shuttle.  I also added a refreshment after a dynamic action on the shuttle to set the value of the right side of the temp variable.

    Ray

  • Need help with update statement to be used in the stored procedure

    I have the following update statement and I get "ORA-06512. Someone of you can help me.

    ----
    UPDATE MO X SET X.MOMODEL = (SELECT Y.MOMODEL FROM MO Y WHERE Y.MOID = A_TEMP_INT3)
    WHERE X.MOID in (UPDATE MO X SET X.MOMODEL = (SELECT Y.MOMODEL FROM MO Y WHERE Y.MOID = A_TEMP_INT3)
    WHERE X.MOID in (A_TEMP_INT1, (select assocchild from mo_association
    Connect prior assocchild = assocparent
    Start with assocparent = A_TEMP_INT1)); (by selecting assocchild in mo_association
    Connect prior assocchild = assocparent
    Start with assocparent = A_TEMP_INT1));
    ----

    Note: A_TEMP_INT1 and A_TEMP_INT3 are the values of cursor and is assigned to numeric values in the code.


    Thanks for all the help in advance.

    Kind regards
    REDA
    WHERE X.MOID IN
     (SELECT ASSOCCHILD   FROM MO_ASSOCIATION
          CONNECT BY PRIOR ASSOCCHILD = ASSOCPARENT
         START WITH ASSOCPARENT = A_TEMP_INT1
         UNION
      SELECT A_TEMP_INT1 FROM DUAL );
    

    Should work.
    VR,
    Sudhakar B.

  • How can I create a button with alpha background and text? When the alpha element group influence all elements, but the text remains 100%

    When the alpha element group influence all elements, but the text remains 100%
    I try with the Group of elements and no group, but include elements in the 'State' of the widget library button. Nothing!

    Explain dough my problem and please excuse my English...
    I need to have a transparent background with text (name and job) at the start. When I rollon with the cursor of the mouse on the button background should take a color with 60% alpha, required text full color stay, but if I group or insert State of the item on Rollo button mouse everything take alpha 60%

    I need to regroup or insert in elements went State button because if they are ungruoped to mouse Rollo on bottom its all is ok, but when the mouse passes over the background of text out you of you initial state.

    Can someone help me please?

    I think I know your problem - are you using the opacity of the 'effects' rather than opacity to "fill" - one of the effects will affect the entire element rather than just the rectangle.

    Use this opacity

    not this one

  • How can I apply a new style with an excerpt and DW artifact of the old style?

    Hello

    I use Dreamweaver CS5 in Windows XP SP3. My problem seems simple, but the resolution remains elusive.

    Let's say I'm stuck-in editing the text in MS Word that DW auto-formaté. I highlight text and use a clip to attach the text of the h2.

    Rather than delete the old style and its replacement by h2, DW applies the h2, but copy the old style, enclosing nothing and it bumps to the next line. If the old style included a paragraph tag, which flows into the extra space. For anything.

    Now, this seems to be a minor thing, but it is not so little, when you try to quickly prepare a large document with different header styles. Having to make dozens of changes that, in my view, should be completely useless becomes a burden.

    Is it possible to attach some text in a new style with an excerpt without the old style of stick around?

    Thanks for all the answers!

    Oreo Say

    If I pointed out this bit and click to apply my excerpt:

    The header

    the result is:

    The header

    You need not of snippets for this.

    Select it

    tag with the selector tag between (bottom of the design view) and the top of the property inspector, then, in the property inspector, Select Heading 2 in the dropdown Format menu.

    DW will replace

    with

  • With Yahoo Mail and Firefox 8.0, the display pane appears on the right instead of below as it does with other browsers. Please notify.

    It started a few days ago. With Internet Explorer and Chrome, the reading pane appears below the Inbox. With Firefox, it appears in a narrow pane to the right of the Inbox.

    The view pane if I click on a message replaces the Inbox in the right pane for me.

    Clear the cache and cookies from sites that cause problems.

    "Clear the Cache":

    • Tools > Options > advanced > network > storage (Cache) offline: 'clear now '.

    'Delete Cookies' sites causing problems:

    • Tools > Options > privacy > Cookies: "show the Cookies".

    Reset the zoom of page on pages that are causing problems.

    Start Firefox in Firefox to solve the issues in Safe Mode to check if one of the extensions or if hardware acceleration is the cause of the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > appearance/themes).

  • TLSIOException with reason '0' and no trace of the stack on the WiFi

    Hello

    I am downloading a file via SSL. On most devices, the file is transmitted without any problem. Probably 20% of devices, transmission of files fails with a TLSIOException with no trace of the stack and no message. The execution of TLSException.getReason () return '0'. There is no common denominator to the problem as OS version bundle or device model, except that it never fails on a cellular connection - only on WiFi.

    I'm out of stuff for debugging this problem. Any thoughts would be appreciated.

    Scott


Maybe you are looking for

  • Reminders in iOS 10 does not synchronize with iCloud

    I have a frustrating problem. If I create or change a reminder in OSX 10.12, or online on iCloud, it syncs to all my devices.  However, if I create or edit a reminder in iOS 10.0.1 it does not sync to iCloud at all. I tried all the remedies I can fin

  • My new orkut page doesn't work anymore after uptading firefox Firefox v9.0.1 at 10

    My new orkut page not working anymore after I in v2.1 this morning my browser firefox Firefox v9.0.1 at 10. I'm looking for this version mozilla Firefox v9.0.1?

  • Windows7

    anyone will be able to upgrade to windows7. I have a hp desktop computer that was purchased in 2007?

  • System 32

    My computer is telling me that Windows cannot find C:\Windows\system 32\rundll32.exe.  What it means and how to fix it? My son was using my laptop and here is the result.

  • How can I put a block of some of them by e-mail or to prevent them to write to me

    Remember - this is a public forum so never post private information such as numbers of mail or telephone! Ideas: You have problems with programs Error messages Recent changes to your computer What you have already tried to solve the problem