Hi all,
The query below is not compiling. Please help: - Select case
-
when isNull(a.[USER_ID],0)=0 Then char(43)
-
when isNull(t.[USER_ID],0)=0 Then char(45)
-
else char(160)
-
end as ind, count(*)
-
from T1 t
-
left outer join T2 a on
-
t.ASSIGNMENT_ID = a.ASSIGNMENT_ID
-
group by ind
-
order by ind
5 1326 iburyak 1,017
Recognized Expert Top Contributor
You can do following ways:
1. - Select case
-
when isNull(a.[USER_ID],0)=0 Then char(43)
-
when isNull(t.[USER_ID],0)=0 Then char(45)
-
else char(160)
-
end as ind, count(*)
-
from T1 t
-
left outer join T2 a on
-
t.ASSIGNMENT_ID = a.ASSIGNMENT_ID
-
group by case
-
when isNull(a.[USER_ID],0)=0 Then char(43)
-
when isNull(t.[USER_ID],0)=0 Then char(45)
-
else char(160)
-
end
-
order by 1
2. - Select ind, count(*)
-
FROM (
-
Select case
-
when isNull(a.[USER_ID],0)=0 Then char(43)
-
when isNull(t.[USER_ID],0)=0 Then char(45)
-
else char(160)
-
end as ind
-
from T1 t
-
left outer join T2 a on
-
t.ASSIGNMENT_ID = a.ASSIGNMENT_ID) a
-
group by ind
-
order by ind
Good Luck.
Thanks a lot iburyak!
This helped...
Thanks a lot iburyak. This helped...
But please help me understanding, why the original query is not working? Where I am missing at. Appreciate your help... Thank you.
TimHop12,
Just want to share may idea why your codes didn't work, because you cant group by a "alias" name in the group statement. on the other hand, if you want to use the "alias" name, you should do a select statement in another select statement.
iburyak 1,017
Recognized Expert Top Contributor
TimHop12,
See Porter's respond it is exactly what it is.
If you need more clarification let us know and we will explain in more details.
Good Luck.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: svilen |
last post by:
hello again.
i'm now into using python instead of another language(s) for
describing structures of data, including names, structure,
type-checks, conversions, value-validations, metadata etc....
|
by: Steven T. Hatton |
last post by:
The following works:
template <typename T>
struct ID3M{
static const T ID;
};
template <typename T>
const T ID3M<T>::ID = {{1,0,0},{0,1,0},{0,0,1}};
|
by: Jack |
last post by:
Imagine if someone asked which of the follwing two methods of encoding
an integer into a byte array was quicker.
The purpose is in preparation for sending across a socket as part of a
'header'....
|
by: naija naija |
last post by:
Hello guys i made a Datagrid with Editing,Update and Cancel using
VS.NET. to my surprise nothing is on the screen after compilation ..
By code below:-
Imports System.Data
Imports...
|
by: touf |
last post by:
Hi,
I like to create a query builder to allow the user to create his statistics
and see them using Cristal report
Any idea about how to do this, is there any controls that can help me.
Thanks.
|
by: codergem |
last post by:
Hello Friends
Can anyone help me where exactly at what address the *p is storing the
updated value ( which is 99).
const int k=9;
int *p=(int *)&k;
cout<<"Addr of k : "<<&k<<" "<<p;
|
by: charles.lobo |
last post by:
Hi,
I have recently begun using templates in C++ and have found it to be
quite useful. However, hearing stories of code bloat and assorted
problems I decided to write a couple of small programs...
|
by: David Abrahams |
last post by:
I'm seeing highly surprising (and different!) behaviors of
PyImport_ImportModule on Linux and Windows when used in a program with
python embedding.
On Linux, when attempting to import a module...
|
by: rparcha |
last post by:
How to convert following MS access quey to SQL server statement
ACCESS:
Testx: IIf(Mid(dbo_ITMaster!City,1,2)="AB",IIf(Mid(dbo_ITMaster!Plan,1,3)<>"XYZ","M",IIf(dbo_ITMaster!Center="1111", "A",...
|
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: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |