Can we combine this into one query, just curious

Dear all;
I have a query of the following form
select t.id, t.place  from tbl_one t
where t.create_date < sysdateand
select t.id, t.place  from tbl_one t
where t.create_date < sysdate + 28just curious, can those two queries be combined to one. Thank you. All help is appreciated.

Is this a trick question? You could combine the two queries using AND / OR clause but it wouldn't really solve anything.
Lets look at each query.
SELECT t.id, t.place FROM tbl_one t WHERE t.create_date < sysdateThe above query would return all records whose create_date is older than sysdate (now).
SELECT t.id, t.place FROM tbl_one t WHERE t.create_date < sysdate OR t.create_date < sysdate + 28The above query would return all records whose create_date is older than sysdate (now) OR records whose create_date is older than sysdate (now) + 28 (or 28 increments in the future). These two queries are the same because if create_date is older than sysdate (now) by default it is older than any time future time. And since OR clause only requires one condition to be true sysdate+28 is unnecessary.
Similarly, we could combine the two queries using the AND clause.
SELECT t.id, t.place FROM tbl_one t WHERE t.create_date < sysdate AND t.create_date < sysdate + 28The above query would return all records whose create_date is older than sysdate AND older than sysdate+28. However, since the AND clause requires both conditions to be true, and since all sysdate +28 > sysdate the above query is equal to
SELECT t.id, t.place FROM tbl_one t WHERE t.create_date < sysdate + 28Basically you COULD combined the two select statements but it would be pointless

Similar Messages

  • I have 3 podcast folders in my iTunes account, how can I combine them into one folder in my iTunes library?

    I have 3 podcast folders in my iTunes account, how can I combine them into one folder in my iTunes library?

    What is the title of the other bookmark folder that can not be deleted?
    '''Try Firefox Safe Mode''' to see if the problem goes away. Safe Mode is a troubleshooting mode, which disables most add-ons.
    ''(If you're not using it, switch to the Default theme.)''
    * On Windows you can open Firefox 4.0+ in Safe Mode by holding the '''Shift''' key when you open the Firefox desktop or Start menu shortcut.
    * On Mac you can open Firefox 4.0+ in Safe Mode by holding the '''option''' key while starting Firefox.
    * On Linux you can open Firefox 4.0+ in Safe Mode by quitting Firefox and then going to your Terminal and running: firefox -safe-mode (you may need to specify the Firefox installation path e.g. /usr/lib/firefox)
    * Or open the Help menu and click on the '''Restart with Add-ons Disabled...''' menu item while Firefox is running.
    [[Image:FirefoxSafeMode|width=520]]
    ''Once you get the pop-up, just select "'Start in Safe Mode"''
    [[Image:Safe Mode Fx 15 - Win]]
    '''''If the issue is not present in Firefox Safe Mode''''', your problem is probably caused by an extension, and you need to figure out which one. Please follow the [[Troubleshooting extensions and themes]] article for that.
    ''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before opening Firefox for normal use again.''
    ''When you figure out what's causing your issues, please let us know. It might help other users who have the same problem.''
    Please report back soon.

  • I seem to have at least two, and maybe four, iCloud accounts, across my iPhone, my iPad and my MacBook Pro. Can I combine them into one iCloud account?

    I seem to have at least two, and maybe four, iCloud accounts, across my iPhone, my iPad and my MacBook Pro. Can I combine them into one iCloud account? I have been able to log into what appears to be three of the four iCloud accounts I have. Two of them seem to be remarkably similar, and one appears to be only for my MacBook.I think I know which one my iPhone is backing up to, as I successfully restored from a back-up last week. The fourth iCloud account I can't access via password or security questions. Any advice would be much appreciated.
    Thanks.
    Cheers,
    Aaron
    Melbourne, Australia

    You cannot merge accounts.

  • I have multiple documents how can I combine them into one document?

    I have multiple document files in Pages. How can I combine them into one document?

    Menu > View > Page Thumbnails > click on the thumbnails > Copy/Paste into thumbnails of other document
    Peter

  • TS3981 After migration files are now shared between two user accounts. How can I combine them into one account?

    After migration, from PC, files are now shared between two user accounts.I have to switch users to access files. How can I combine them into one account?

    See Pondini's  Transferring files from one User Account to another, for starters

  • A music album is listed multiple times in my library but each listing only has a few songs in it-not the full listing.  How can I combine them into one album and get rid of other duplicate listings?

    Several music albums listed in my IPhone 5 music library are listed multiple times, but each one only has a portion of the songs listed.  How can I combine them to make one album?

    First....Thank you so much for your prompt reply.  I am sorry for not getting back to you regarding your suggestion-I had computer issues that just got resolved.  Also, this is my first foray into online chat rooms so I have a lot to learn to precisely state my issue!  I did as you suggested and all the songs list the same album when I go into each song's "get info".  However, I am not sure how to edit as you suggested. When I downloaded this album originally, for some reason it broke up into several albums each with different songs from the original album.  I am trying to consolidate them back into one album in my library.  I would greatly appreciate further assistance if you can.  Also, I do not use "the cloud" to store any data and would like a good source of info on how to do this.  Thanks so much for your patience!
    SueZoo

  • I publish identical podcasts under different URLs.  How can I combine them into one?

    Over the years, my URL has changed a couple of times.  I didn't know (until recently) how to notify iTunes that the podcast location and URL had changed.  So, now after a number of years, I have three identical podcasts, each with different a different URL and a different list of subscribers.  I have them pointing to the same source file now, but I would love to combine the podcasts into one so that the subscribers from each are merged together and they don't show up as three possible subscriptions in iTunes.  Is this possible?

    You can't merge them: all you can do is to ask to have two of them deleted, and of course if you do that you will lose any ratings. However existing subscribers should all be using the same feed if the three Store pages are all using the same feed, and so removing two of them won't have any effect on subscribers.
    The method of getting a podcast removed is detailed here:
    http://www.apple.com/itunes/podcasts/specs.html#removing
    When you explain why you want each one of the two you choose removed, specifically say that the same feed is in use in three places, so you can't use the 'itunes:block' tag (because this would block all three).

  • I Movie 09 can I combine projects into one project?

    Can I combine 3 seperate IMovie projects into one so I can burn a short film to DVD?
    I had three different people shoot 3 different sections of a short for me, now I want to put them in one project together in order and burn a DVD.

    you can copy (copy all) the clips from one project and paste them into another clip, but music and titles will not come with that. If you export one project as a .mov file and then reimport it into iMovie as suggested, that will easily work, but you wont be able to edit that movie's music or titles.
    rr

  • I've been importing all my old CDs into itunes but one of them which was unknown imported as single tracks. How can I combine these into one album

    I've been importing all my old CDs into itunes but one of them which came up as unknown has imported as single tracks named track 1, track 2 etc. It wasn't an obscure CD (Paul Carrack - the journey so far) but not one that's available in the itunes store. I've manually changed the track names but they all appear as single tracks in the "Albums" section. Is there a way to put them all into an album to show up as an album with the other albums. Other "unknown" CDs I imported have imported with the correct track names but just don't have the album artwork so I don't understand why this one is behaving totally different?

    If you select the tracks all together in iTunes/ Songs then go to File/Get info you will be asked "Are you sure you want to edit information for multiple items?" Go ahead and you can make them into an album, putting in the artist name, etc.

  • Songs from an Album download as separate "albums" sometimes.  Can I combine them into one?

    Downloading songs from cd's.  One will go in as one album, shows a single artwork for the set.    Volume 2 loads like separate songs with the same album name AND with the sequence number, i.e., No. 4 of 15,  On my iPad it appears as 15 albums with 1 song on them.  Volume 1 appears as one album with 15 songs on it.  Looks messy on the iPad. . .I have 16 albums with the same name.    How to get albums together??

    Steve MacGuire aka turingtest2 - iTunes & iPod Hints & Tips - Grouping Tracks Into Albums - http://www.samsoft.org.uk/iTunes/grouping.asp (older post on Apple Discussions http://discussions.apple.com/message.jspa?messageID=9910895)
    Quick answer:  Select all the tracks on the album, File > get info, and either give them all a single "album artist", or check the "compilation" flag (as in https://discussions.apple.com/message/17670085).
    If these are from multiple-CD sets you may also need to enter the appropriate information in the disc number fields.

  • I have three e-mailaccounts how can I combine them into one account?

    My ex-wife has our family account on a e-mail account that we still use for the family. However I have created my own account which by mistake I entered it wrong on the app store and already created two accounts wrong as the new account.  I want to put the correct account to the correct e-mail and add it to the one account I have to my family account.  Example would be I have a @msn.com and a @Hotmail account but I need the MSN account to be deleted and to use the Hotmail account and then add the Hotmail account to the @family account.

    With all these errors it may be best to talk to the security team who should be able to unravel the situation.   Go to your national contacts via ...
    http://support.apple.com/kb/HT5699   And follow instructions.

  • Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it?

    Trying to drag pdf files i have and combine them into one pdf file in the account i just purchased with Adobe. when i drag a pdf file over Adobe doesn't accept it. says it can not convert this type of file. but it is an Adobe file. Do I need to change it in some other form befor dragging it?

    Hello djensen1x,
    Could you please let me know what version of Acrobat are you using.
    Also, tell me your workflow of combining those PDF files?
    Please share the screenshot of the error message that you get.
    Hope to get your response.
    Regards,
    Anubha

  • Combining Sum/Case queries with different where clauses into one query

    Hello,
    I'm trying to combine 2 queries that contain the SUM/CASE function into one query that'll produce the output in the same table, rather than having two The thing is, the two queries have different conditions. I've created a sample data table and outputs to better describe what I'm trying to achieve.
    SAMPLE_DATA
    DEPT
    PROD_CODE
    FLAG1
    FLAG2
    HO
    A
    NULL
    Y
    HO
    B
    NULL
    Y
    HO
    A
    Y
    NULL
    HO
    B
    Y
    Y
    IT
    A
    NULL
    Y
    IT
    C
    NULL
    NULL
    ENG
    B
    NULL
    Y
    ENG
    C
    NULL
    Y
    ENG
    C
    Y
    Y
    MKT
    A
    Y
    Y
    The first query I'm running is to sum the product codes department wise while checking if FLAG1 is Y. The second query is checking if FLAG2 is Y.
    First Query:
    select DEPT, sum(case PRODUCT_CODE when 'A' then 1 else 0 end),
    sum(case PRODUCT_CODE when 'B' then 1 else 0 end),
    sum(case PRODUCT_CODE when 'C' then 1 else 0 end)
    from SAMPLE_DATA where FLAG1 is not null group by DEPT;
    Second Query:
    select DEPT, sum(case PRODUCT_CODE when 'A' then 1 else 0 end),
    sum(case PRODUCT_CODE when 'B' then 1 else 0 end),
    sum(case PRODUCT_CODE when 'C' then 1 else 0 end)
    from SAMPLE_DATA where FLAG2 is not null group by DEPT;
    FIRST QUERY OUTPUT:
    DEPT
    PRODA_FL1
    PRODB_FL1
    PRODC_FL1
    HO
    1
    1
    0
    IT
    0
    0
    0
    ENG
    0
    0
    1
    MKT
    1
    0
    0
    SECOND QUERY OUTPUT:
    DEPT
    PRODA_FL2
    PRODB_FL2
    PRODC_FL2
    HO
    1
    2
    0
    IT
    1
    0
    0
    ENG
    0
    1
    2
    MKT
    1
    0
    0
    My aim is to combine both the queries so that the output is displayed the same way as the table below.
    DESIRED OUTPUT:
    DEPT
    PRODA_FL1
    PRODB_FL1
    PRODC_FL1
    PRODA_FL2
    PRODB_FL2
    PRODC_FL2
    Any help or tips will be greatly appreciated. Please note I'm working with more complex data and have simplified my question just to understand how to solve this.

    Just treat the two queries as tables, join them on DEPT and produce the results you want.
    with q1 as (
    select DEPT, sum(case PRODUCT_CODE when 'A' then 1 else 0 end) PRODA_FL1,
    sum(case PRODUCT_CODE when 'B' then 1 else 0 end) PRODB_FL1,
    sum(case PRODUCT_CODE when 'C' then 1 else 0 end) PRODC_FL1
    from SAMPLE_DATA where FLAG1 is not null group by DEPT),
    q2 as (
    select DEPT, sum(case PRODUCT_CODE when 'A' then 1 else 0 end) PRODA_FL2,
    sum(case PRODUCT_CODE when 'B' then 1 else 0 end) PRODB_FL2,
    sum(case PRODUCT_CODE when 'C' then 1 else 0 end) PRODC_FL2
    from SAMPLE_DATA where FLAG2 is not null group by DEPT;
    select q1.dept, proda_fl1, prodb_fl1, prodc_fl1, proda_fl2, prodb_fl2, prodc_fl2
    from q1, q2
    where q1.dept = q2.dept

  • I need to deactivate two old computers and reinstall CS3 on two new computers. How can I do this if one is long gone and the other just crashed?

    I need to deactivate two old computers and reinstall CS3 on two new computers. How can I do this if one is long gone and the other just crashed?

    contact adobe support and request an activation count reset, http://helpx.adobe.com/x-productkb/global/service1.html

  • Saving combined PDFs into one new document?

    I know how to combine PDFs into one document using Preview, but I am not finding any way to save the resulting new document.  There is no "save as" any longer in Preview, and when I choose "save", it only saves the first document, not the whole collection of documents.
    There must be a way to do this!  There used to be, and it was easy as pie. 
    Can someone help, please?
    Mark Carlson

    Thank you.  I was able to conjure up "save as"--though why should you have to hold down the option key? Why isn't "save as" just there? Well, it doesn't really matter, since "save as" still only saves one of the documents in the combined bunch.
    But your second method of accessing it through Print worked just fine.
    Thanks so much!
    Mark

Maybe you are looking for

  • Error code 6000 while setting up Pixma MG 5420

    Carefully unpackaged unit and installed print head,(have not installed ink cart) and print head went to extreme right of carriage and seems to be stuck in that position, don't see any type of release to move it back to the center. Have a 6000 error c

  • Best Practices for SES

    Are there any: 1) Best Practices documents 2) Project methodology 3) Project evaluation techniques/pointers documents for SES? Apologies if this has been posted before. Please point me to any such post I might have missed. Thanks in advance.

  • After rendering I have video but no audio

    Completed publish/share of video with several narrated clips in Window Media PC playback.  Video saved and will play but does not have audio.

  • Thinking about a xoom

    Im thinking about a xoom but i confused on how the plan works. When i select a xoom on the website it says select a phone to upgrade and im noy upgrading im trying to get a xoom

  • GC not cleaning up in solaris

    Hello, I am running my application on jdk build 1.5.0_04-b05 and build 1.5.0_01-b08 on both solaris and windows XP. I am performing a stress test on my application. In solaris, 1> With 64 bit opteron processor the application goes out of memory with