I find it annoying that you can't use aliases in where statements

I find it annoying that you can't use aliases in where
statements
for example:
SELECT TOP 1
CAST(amount
/ ( CASE WHEN ISNULL(rate, 0) <> 0 THEN rate
ELSE 1
END ) AS NUMERIC(10, 2)) AS num
FROM table
WHERE num > 1
ORDER BY num
Are there any workarounds?

> I find it annoying that you can't use aliases in where
statements
This isn't really (or... "at all") a CF question. You're
better off asking
this sort of thing on a SQL Server forum.
You could use a derived table, I guess:
select top 1 num
from (
SELECT
CAST(amount
/ ( CASE WHEN ISNULL(rate, 0) <> 0 THEN
rate
ELSE 1
END ) AS NUMERIC(10, 2)) AS num
FROM table
where num > 1
order by num
(that might not preserve the intent of you SQL (sorry: it's
late, I'm
tired), but you get the idea.
Adam

Similar Messages

  • I find it rather frustrating that you can't use things like {myArray[0]} in Bindable expressions

    I find it rather frustrating that you can't use things like
    {myArray[0]} in Bindable expressions. Are there any workarounds
    apart from manually changing the dataprovider?

    Yes, instead of an array you have to use an arraycollection
    (just wrap your array) and then you can use this with the
    getItemAt()-method.
    e.g.
    {myArrayCollection.getItemAt(0)}
    cheers
    Dietmar

  • HT1665 Recently read on a deal site forum page that you can only use Apple lightning cables to charge iPads running iOS 7 or higher. Is that the case or will any 8-pin to USB cable work? Thx in advance for any helpful replies.

    Recently read on a deal site forum page that you can only use Apple lightning cables to charge iPad Air or iPad Mini Retina running iOS 7 or higher. Is that the case or will any 8-pin to USB cable work? Thx in advance for any helpful replies.

    Due to a lot of bad press that Apple was getting due to burnt chargers, shocked users (the electrical kind...), etc., due to the lousy third party El Cheapo brand generics, as of iOS 7 the cable must be Apple-certified before the iGadget deigns to use it for charging purposes. Unfortunately (for Apple) the old traditional USB to 30-pin cable is just that, a straight piece of wire, and can't be validated by the iGadget. But lo & behold, the new gear uses the new Lightning cable, which contains an embedded chip that CAN be validated and lousy imitations disabled from use.

  • How do you transfer your music in Amazon Cloud to  finder music so that you can burn it to cd?

    I have ordered a cd burner and want to burn the songs I have in Amazon Cloud.   There are two albums.   I think you can burn them from  Music in Finder.....  How do I get the songs to Music in Finder from Amazon Cloud?    thanks in advance.

    I downloaded the Amazon program and transferred my songs to ITunes and my Finder music.....  It happened at the same time.... I didn't realize that.....  Now I am ready and thank you for the support.... It helped.... 

  • Is anyone else annoyed that you can't open a normal file with preview in CS6 on the Windows platform

    Please, please , please restore the the ability of Photoshop to open with a preview on windows machines. That is; a single click on a file from within Photoshop gives a small preview image to tell you what it is you are opening.  This is crucial to professional photographers in the industry working quickly with lots of images as I do in the medical/scientific photography field. 
    Every other version of Photoshop has had this feature and I can tell you a lot of power users like myself are not using CS6 just because a single click doesn't preview what you are opening.  My company just spent $10,000 upgrading six machines and no-one is using CS6 for work - they are sticking with CS5.  CS6 is only good for 'playing around' with photos, if production is key, then to save time, we need to see what we are opening on a single click - it's a no brainer!  Check the forums to see this that is true, and if you are reading this and agree with me, write and tell adobe to fix this - pronto!

    Thanks for correcting my quote/unquote quotes.  Yes you are right.  Not a very good use of them.  I took time out to look at your photos.  Very nice.  I also play around with photoshop on my ladscape and fine art photos when I am not trying to make a living (that is paying my mortgage, sending kids to school buying food etc).   I exhibit these in galleries and enjoy the luxury of spending the extra time on them - they even sell occassionaly. 
    Sorry if you were offended by the use of the term playing around with photoshop. Obviously your work is very nice. Unfortunatly I cannnot show you the work I do at work because of patient confidentiallity and, quite frankly, the images are mostly gross anatomy, wounds, lots of blood - not the sort of thing I like to share unless you are a health professional. 
    Anyway, since you have posted, can you help me with the problem is the question I beg to ask.

  • When try to view a movie with a external reader it makes a weird noise at time and other times works fine I think I read somewhere theat you can only use thereader that came with your computer

    When I put a movie DVD in my external reader it makes a strange noise and at times it gets hung up I have to force quit it and then I can eject the dvd
    I believe I read some wherre that you can only use the reader that came with my computer

    That sounds like the drive is faulty. CD and DVD will have seperate heads, and burn and read will be different lasers in each. If it's still in warranty I'd exchange it.

  • You can't use Contribute to edit this type of file

    I've updated a few pages from a website, so they're just
    variations of pages that used to work with Contribute. Now I'm
    getting a message--on some of them--that "you can't used Contribute
    to edit this type of file." These are html files with the extension
    htm. They contain tables. They are based on templates. They don't
    seem to have any other distinguishing properties. Exactly what kind
    of files don't work? What might I be doing wrong? I teach this at a
    college & my students are as puzzled as I am.

    Ancient thread, but if anyone else is googling this phrase I thought I might respond with a possible answer.  I encountered the same error but could not find anything wrong with the page in question.  Turned out the page getting the error message was fine! The issue was actually with a simple typo on the page that linked to that page--it was missing the extension (e.g., linking to "page2" instead of "page2.php".  The web server (and Contribute's browser) were pulling up the page even though the extension was missing but Contribute didn't know what kind of file it was so it refused to allow editing.

  • Really stupid that you can't drag and drop photos from Finder into Events

    There is no way in iPhoto to do what I want and need to to, to wit, drag and drop photos from the Finder into existing iPhoto Events.
    It really doesn't make sense that you can't do this. First of all, calling these groups Events to begin with is not smart; in my case, a group of photos in a folder on the Finder is rarely all from one photo session or so-called "event"--- instead of Events they should just be called Groups or something, and you should be able to drop individual photos into them. I have thousands of family photos that were accumulated on my hard drives over the years, some scanned in from film negatives, slides, or prints, others from digital cameras, and when I have changed Macs and hard drives over the years, every time a folder of photos was moved from an old hard drive to a new one, or regrouped into various folders, the photos seem to have acquired new dates of origin, etc.
    Anyway, what I mean is, if Events are all time based, then somebody like me who has thousands of photos with all sorts of dates of origin, mostly unrelated to the date that the photo was actually shot, is screwed. I have old photos with new dates of origin and other mismatches between photos and the dates when they were actually shot or scanned.
    My gripe is, again, that when I find photos on my hard drives that belong in certain iPhoto Events that have already been created, I cannot just drag these photos from the Finder and drop them into the Events they belong in. Instead, the stupid program creates a new Event from each photo I try to drop into an existing Event. That means I have to chase these new photos all over the place inside of iPhoto, trying to figure out where each new photo (now called an "Event") has ended up, so that I can drag and merge it into the Event I wanted it to go into in the first place. A real pain in the neck. It simply takes too long to do this for each photo added.
    What this means is that iPhoto is not going to be a practical way to organize for a person like me until Apple makes it possible to simply drop any photo from the Finder into an existing Event. There should be an option to allow that. I'm really surprised there is not one. <edited out by Hosts>
    Tom

    Tom, iPhoto will not overwrite photos with the same name. I have plenty of photos with the same name in the same event. Each photo most likely has an internal handler that manages the photo, and not just the name of the file.
    I agree with you that this is sub-optimal, and (IMO) I think what happened is iPhoto 6 had rolls, and they came up with a really cool interface for mousing over those rolls, and decided it was more consumer friendly (and because film is a thing of the past) to call them events, rather than rolls. I think it was worth a shot, but they just slightly missed.
    Right now in iPhoto08, any serious organization is done in folders and albums. Personally, I think they need to combine the two concepts -- the great "mouse over" view of events with the organization abilities of folders and albums. I'd like an albums view where I can mouse over the albums. Actually, Aperture 2's interface for organization is more functional than iPhoto, so I am hoping some of that benefit creeps into the next iPhoto release.
    What I do is: I use events for high level grouping (like Winter 2007) and I organize folders and albums to break that down further ("trip to Montreal" "Christmas" etc.). But I do it backwards. I fill albums first, then I organize events.
    When I drag in pictures to iPhoto, first I make the target album in iPhoto that I want to populate, then I drag the photo directly to that album (not to events). iPhoto automatically puts the photo into the album I created and also into a new event. Later, I go into events, right-click on this new event to "open event in separate window" then I move around the events view, to drop in the pictures from the "import" event I just created. If I move all the pictures into other events, iPhoto automatically deletes the event I just emptied. You could skip the event organization all together if you wanted to, but you'd lose the cool mouse-over feature, which can be handy.
    One nice thing about having events AND albums is you can have the photo just once in iPhoto, in an event, but then have the photo appear in as many albums as you want (as well as projects and web galleries) all while only having one photo on your hard drive. So, there are benefits to events, but I think iPhoto is missing just a couple little bits of organizational ability to make it perfect. (and yes, I've submitted this all to Apple as feature requests)
    Just in case you don't know -- events don't have any hierarchy. That is, you can't nest events. But you can have folders with subfolders, and any folder can contain albums. Albums cannot have sub-albums, and folders don't hold photos. Only albums hold photos, and folders (or sub-folders) hold albums. Try create some folders and albums and you'll get the hang of it. One other issue that Apple needs to address. When you create a new folder or album, it doesn't put it right where you want it, but rather puts it at the bottom of the list, so you have to drag it up to where you want it. Try it out, and you'll see what I mean, then submit it as a feature request to improve that.
    I agree it's not perfect, but it's not too bad once you get used to it. And the benefits of working with the rest of the features of iPhoto is worth it. I'm just really hoping they do a few tweaks on the next release. They are near greatness here. They could just use a little nudge on the last bits. (in my opinion of course. Others may disagree, but I've talked to enough people who have the same issues you are having to know we are not alone on this).

  • Where do you find the ringtone tab on your personal itunes so that you can sync new ringtones to your iphone?

    Where do you find the ringtone tab on your personal itunes so that you can sync new ringtones to your iphone? I am trying to get ringtones from my ringtone app onto my phone and the directions said to click Ringtones on the top of iTunes. I am having trouble finding the Ringtones on the top of iTunes.

    Go to edit then preferences in itunes on your computer and then check the box TONES and then click OK.  with your phone attached to your computer with USB cable select the name of your phone on the left and then in window on right select TONES from the menu items across the top of the window

  • Anyone else annoyed that you have to keep computer active to use appleTV 2

    Its 2011, I know longer find a need for a desktop now that laptops are so powerfull.  I am really annoyed that in order to use my new AppleTV I need to keep my laptop from falling asleep.  Ok, I could probably live with that if there was a way to close the display on my laptop without putting it to sleep, but as of now the best I can do, since I don't have an external display, is setup the energy saving settings to never go to sleep, but turn off display after 15 minutes, then either leave my laptop open, or close it almost shut with a towel in the middle.  One would think, that the geniuses over at apple devolopment would figure out a way for the Apple TV to send a signal across the network that would wake up a closed(asleep) laptop or desktop.  I can wake my computer up remotely over the internet from across the country, but I can't get my Apple TV to wake my computer up across the house.  Sounds to me like you guys dropped the ball on this one.  I mean who leaves there laptop/desktop on all day when they are at work, at the least they put it to sleep(or it goes to sleep on it's own after an hour).  How annoying is it to have to go into your office, wake up your iMac, login into your account (if applicable), open iTunes, then go back into the living room/bedroom every time you want to use your apple TV.  If you can't make it at least wake up an asleep mac, why not put iTunes on the apple TV and set it up so iCloud can stream your movies and music to the Apple TV.  I mean come on Apple. Where is the innovation in this product? One would be better off purchasing a mac mini, and using the TV as your display. Then you would be able to do anything with itunes, you could use the mac mini as your main homeshare hub and you would be able to do anything from your tv.
    There is only one other solution I can think of, and I am not sure if it is even possible,  but if you could put Itunes on a wifi hard drive with all your libraries stored there, then maybe the AppleTV can access the Network Drive and solve my delema.  Does anyone know if this is possible?

    Yes, wake for network access is checked.  You would think that would take care of the problem, but no it does not.  Bottom line is apple dropped the ball when it came to the AppleTV 2.  It is just as easy for me to plug my laptop into my TV every time I want to watch a movie through iTunes as it is to wake up my laptop every time I want to use my AppleTV.   If I have to tunr on, log in, wake up, or basically use my laptop to use an AppleTV,  why not just plug my laptop into my TV, then I get full internet access and more, not just itunes streaming and access to internets apps of Apple's choice. like MLB and NBA, but no NFL or Hockey.  no Pandora, Hulu, Blockbuster, Facebook, Twitter, ..., ect. I really hope Apple sees my point and takes this into consideration. 

  • I am trying to download iTunes to my Sony PC,  but "This installation package could not be opened.  Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer Package."

    mI am trying to download iTunes to my Sony PC, but I keep getting the following error after initial download attempt:
    "This installation package could not be opened.  Verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer Package."
    I have Windows 7 Home Premium, Service Pack 1.
    Any help is greatly appreciated.

    Hi gump68,
    Thanks for visiting Apple Support Communities.
    You may find the steps in this article helpful if iTunes is not installing on your PC:
    Issues installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/HT1926
    All the best,
    Jeremy

  • HT5030 whem installing itunes i get this message "this installation package could not be opened. Verifiy that the package exists and that you can access it, or contact the application vendor to verify that this is a valid windows installer package"

    whem installing itunes on my mums new computer which is windows 7 i get this message everytime "this installation package could not be opened. Verifiy that the package exists and that you can access it, or contact the application vendor to verify that this is a valid windows installer package"

    Let's check your Windows system.
    1.  Have you done all the important windows updates and service Packs on your system.  If not do it now.  START button, type in Windows Update and ENTER.  Select 'CHECK FOR UPDATES'
    2.  Let's check your Windows system files for possible file corruption
    SCAN and repair possible Windows system file corruption:
    Go to command prompt (START/ALL PROGRAMS/ACCESSORIES right mouse click "command prompt" and choose "Run as Administrator"
    type in
    sfc /scannow
    let Windows fix any system files that need to be repaired.
    Restart the computer if it did actually repair any files.
    3.  Check your system for possible Malware.  But you have to do it in WIndows Safe Mode.
    Start your computer in "Safe mode with networking", go to this link download a free version of Malwarebyte.
    http://www.malwarebytes.org/products/malwarebytes_free
    Install and perform update immediately, then do a full SCAN. Remove malware if it indeed finds any. Restart computer to regular windows to let Malwarebyte complete the removal.
    To start your computer in safe mode
    Press and hold the F8 key as your computer starts. You need to press F8 before the Windows logo appears. If the Windows logo appears, you'll need to try again by waiting until the Windows logon prompt appears, and then shutting down and restarting your computer.
    On the Advanced Boot Options screen, use the arrow keys to highlight the "safe mode with networking" option, and then press Enter. Log on to your computer with a user account that has administrator rights.
    When your computer is in safe mode, you'll see the words Safe Mode in the corners of your screen. To exit safe mode, restart your computer and let Windows start normally.

  • I-tunes won't download onto Windows XP.  Error message 'this application package could not be opened. Verify that the package exists and that you can access it, or contact the application vendor to verify that this a a valid window Installation package'.

    How do you download i-tunes onto Windows XP when error message occurs, 'This application pack could not be opened. Verify that hte package exists and that you can access it, or contact the application vendor to verify that this is a valid window installation package'.

    I wish I knew because i'm having the same problem. As soon as I find the answer I will post.

  • This installation package could not be opened, verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid windows installer package

    I have tried and tried to install itunes on my mums zoostorm windows 7 64-bit pc and it comes up with this message "this installation package could not be opened, verify that the package exists and that you can access it, or contact the application vendor to verify that this is a valid windows installer package" i have tried everything that i have been told to do and nothing has worked but then i try to install it on her toshiba satellite pro windows 7 32-bit as she reset it back to factor settings she has done ALL updates she had itunes on her laptop before but when we went to install it back on the laptop it cam up with the same message as it did on the pc i would really like it if someone can please help with this problem as i am getting so annoyed with it. I have a zoostorm windos 7 32-bit laptop and i have reset that bk to factory settings and i installed itunes on there with no problems so a soultion would be really great.
    Many thanks Donna

    I'd first try downloading an installer from the Apple website using a different web browser:
    http://www.apple.com/quicktime/download/
    If you use Firefox instead of IE for the download (or vice versa), do you get a working installer?

  • Help!!! i updated itunes and now im trying to sync some videos from itunes snd it keeps giving me that you earase and sync you can only use one computer at a time

    okay so i updated itunes and now it wont let me sync anything it keeps giving me that "you can only be synced with one computer at a time erase and sync"  but this is the only computer ive ever used!!!  pleeeease help!!
    <Edited By Host>

    Re: That garbage is unreadable.
    If you really want help, stop messing with the fonts and post so that others can read and offer suggestions.
    Or better yet... try a search, I'm certain you'll find a solution to whatever issue you're experiencing.
    I have found that many times it is the things that make you most angry that push you to action. This was the case here. Thank you for causing me to get so angry that I found the answer myself.

Maybe you are looking for