473,385 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

What am I doing wrong on this one?

Good afternoon,

I always enjoy writing sql, even more when I run into things like this. I am trying to get the count between two dates as well as add aliases to the table which you will see after the "as" statements. I am receiving the error Incorrect syntax near the keyword 'as'.

Here is my code:

SELECT
LoanNum,
RecordNum,
RequestNum,
case
when CloseDt is null
then CAST(SubmitDt - getdate() as int)
as RequestAge
else CAST(SubmitDt - Closedt as int) as RequestAge
end
case
when Followupdt is null
then CAST(SubmitDt - getdate() as int) as AgeFromLastActivity
else CAST(Followupdt - getdate() as int) as AgeFromLastActivity
end
AssigneeName,
Category,
RequestType,
RequestSource,
SubmitDt,
OrderDt,
FollowupDt,
CloseDt,
Disposition
FROM ProdAdmin.dbo.tblAuditSupportRequest
order by LoanNum
Jan 6 '11 #1
1 1154
Rabbit
12,516 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. (CASE WHEN boolean THEN 'text1' ELSE 'text2' END) AS Field1
  2.  
Jan 6 '11 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Aaron Ackerman | last post by:
I cannot a row to this bound DataGrid to SAVE MY LIFE! I have tried everything and I am at a loss. The using goes into add mode with the add button adds his data then updates with the update...
2
by: Phil Certain | last post by:
Hi, Relative newbie to .Net but experienced with classic ASP. I am trying to create a simple business object to contain commonly used functions. This is what I have done: 1 - Created a simple...
2
by: vvenk | last post by:
Hello: I have the following code: Dim lsFilter As String = Nothing Select Case rblStatus.SelectedItem.Value Case "S" lsFilter = String.Concat("D_STAT_CD_C = '", "N'") Case "R" lsFilter =...
12
by: questions? | last post by:
I am testing a problem with linked list. I just do a lot of times: create a list, then free it. ############################################# # include <stdio.h> # include <stdlib.h> struct...
0
by: Steve | last post by:
I have a gridview which uses an objectdatasource for its select and delete. The delete command uses the function below. The delete itself works but the extra logic which requires parameters...
8
by: watkinsdev | last post by:
Hi, I have created a mesh class in visual studio 6.0 c++. I can create a device, render objects and can edit the objects by for instancnce selecting a cluster of vertices and processing the...
0
by: shapper | last post by:
Hello, I am creating a class with a control. I compiled the class and used it on an Asp.Net 2.0 web site page. I can see the begin and end tags of my control (<oland </ol>) but somehow the...
16
by: SirG | last post by:
I'm looking for an explanation of why one piece of code works and another does not. I have to warn you that this is the first piece of Javascript I've ever written, so if there is a better way or a...
10
by: Enkidu | last post by:
Beginner question, sorry! I am using indexers to access an array of StringBuilders in an instance of a class: Getting: value = board1; Setting: board1 = value1 ;
10
by: DavidSeck.com | last post by:
Hi, I am working with the Facebook API right now, an I have kind of a problem, but I don't know what I am doing wrong. So I have a few arrays, f.ex.: User albums: array(2) {
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.