Sum based on column value with no-null results
Need your help.
Having this table:
Airline WKS TypePrint nprints Eventtime
UX MAD2AKB503 BTP 1 2018-08-31 09:41:13.360
UX MAD2AKB503 GPP 1 2018-08-31 09:41:32.723
UX MAD2AKB503 GPP 1 2018-08-31 09:41:39.700
KLM MAD2AKB426 GPP 1 2018-08-31 09:46:03.727
KLM MAD2AKB426 GPP 1 2018-08-28 04:44:22.650
KLM MAD2AKB426 GPP 1 2018-08-28 04:44:29.000
UX MAD2AKB497 GPP 1 2018-08-29 06:03:24.517
KLM MAD2AKB426 GPP 1 2018-08-31 10:10:23.193
KLM MAD2AKB426 GPP 1 2018-08-31 10:10:30.837
UX MAD1AKB223 GPP 1 2018-08-05 20:01:57.857
I would like to sum nprints based in typeprint and Airline column by grouping by WKS. I tried with code as follows:
declare @fecha_inicio date='01-01-2018';
declare @fecha_fin date='12-01-2018';
declare @Airline_id varchar(10)='UX'
SELECT wks,
@Airline_id,
(SELECT Sum (Cast (nprints AS INT)) AS GPP
FROM dw_prints2 B1
WHERE ( B1.airline = @Airline_id )
AND B1.typeprint = 'GPP'
AND ( ( B1.eventtime >= @Fecha_Inicio )
AND ( B1.eventtime <= @Fecha_Fin ) )
AND A.wks = B1.wks) AS GPP,
(SELECT Sum (Cast (nprints AS INT)) AS BTP
FROM dw_prints2 C1
WHERE ( C1.airline = @Airline_id )
AND C1.typeprint = 'BTP'
AND ( ( C1.eventtime >= @Fecha_Inicio )
AND ( C1.eventtime <= @Fecha_Fin ) )
AND A.wks = C1.wks) AS BTP
FROM dw_prints2 A
GROUP BY wks
ORDER BY wks
returning:
wks Airline_id GPP BTP
MAD1AKB223 UX 1 NULL
MAD2AKB426 UX NULL NULL
MAD2AKB497 UX 1 NULL
MAD2AKB503 UX 2 1
However my intention is not to return WKS when sum is NULL for GPP and BTP. I mean:
wks Airline_id GPP BTP
MAD1AKB223 UX 1 NULL
MAD2AKB497 UX 1 NULL
MAD2AKB503 UX 2 1
thanks in advance for your help.
sql sql-server tsql
add a comment |
Need your help.
Having this table:
Airline WKS TypePrint nprints Eventtime
UX MAD2AKB503 BTP 1 2018-08-31 09:41:13.360
UX MAD2AKB503 GPP 1 2018-08-31 09:41:32.723
UX MAD2AKB503 GPP 1 2018-08-31 09:41:39.700
KLM MAD2AKB426 GPP 1 2018-08-31 09:46:03.727
KLM MAD2AKB426 GPP 1 2018-08-28 04:44:22.650
KLM MAD2AKB426 GPP 1 2018-08-28 04:44:29.000
UX MAD2AKB497 GPP 1 2018-08-29 06:03:24.517
KLM MAD2AKB426 GPP 1 2018-08-31 10:10:23.193
KLM MAD2AKB426 GPP 1 2018-08-31 10:10:30.837
UX MAD1AKB223 GPP 1 2018-08-05 20:01:57.857
I would like to sum nprints based in typeprint and Airline column by grouping by WKS. I tried with code as follows:
declare @fecha_inicio date='01-01-2018';
declare @fecha_fin date='12-01-2018';
declare @Airline_id varchar(10)='UX'
SELECT wks,
@Airline_id,
(SELECT Sum (Cast (nprints AS INT)) AS GPP
FROM dw_prints2 B1
WHERE ( B1.airline = @Airline_id )
AND B1.typeprint = 'GPP'
AND ( ( B1.eventtime >= @Fecha_Inicio )
AND ( B1.eventtime <= @Fecha_Fin ) )
AND A.wks = B1.wks) AS GPP,
(SELECT Sum (Cast (nprints AS INT)) AS BTP
FROM dw_prints2 C1
WHERE ( C1.airline = @Airline_id )
AND C1.typeprint = 'BTP'
AND ( ( C1.eventtime >= @Fecha_Inicio )
AND ( C1.eventtime <= @Fecha_Fin ) )
AND A.wks = C1.wks) AS BTP
FROM dw_prints2 A
GROUP BY wks
ORDER BY wks
returning:
wks Airline_id GPP BTP
MAD1AKB223 UX 1 NULL
MAD2AKB426 UX NULL NULL
MAD2AKB497 UX 1 NULL
MAD2AKB503 UX 2 1
However my intention is not to return WKS when sum is NULL for GPP and BTP. I mean:
wks Airline_id GPP BTP
MAD1AKB223 UX 1 NULL
MAD2AKB497 UX 1 NULL
MAD2AKB503 UX 2 1
thanks in advance for your help.
sql sql-server tsql
add a case to where clause or do a sub select and exclude where those are null
– Brad
Nov 12 at 15:46
1
Not the same question (since you didn't mention you tried to useWHERE GPP is not null
or so), but still the same answers: 'invalid column name' while using the HAVING. Basically, either wrap the whole select in another, so you can filter by those virtual columns, GPP and BTP, or copy the entire condition to thehaving
clause. Given the complexity of the expressions, I would definitely do the first.
– GolezTrol
Nov 12 at 15:52
add a comment |
Need your help.
Having this table:
Airline WKS TypePrint nprints Eventtime
UX MAD2AKB503 BTP 1 2018-08-31 09:41:13.360
UX MAD2AKB503 GPP 1 2018-08-31 09:41:32.723
UX MAD2AKB503 GPP 1 2018-08-31 09:41:39.700
KLM MAD2AKB426 GPP 1 2018-08-31 09:46:03.727
KLM MAD2AKB426 GPP 1 2018-08-28 04:44:22.650
KLM MAD2AKB426 GPP 1 2018-08-28 04:44:29.000
UX MAD2AKB497 GPP 1 2018-08-29 06:03:24.517
KLM MAD2AKB426 GPP 1 2018-08-31 10:10:23.193
KLM MAD2AKB426 GPP 1 2018-08-31 10:10:30.837
UX MAD1AKB223 GPP 1 2018-08-05 20:01:57.857
I would like to sum nprints based in typeprint and Airline column by grouping by WKS. I tried with code as follows:
declare @fecha_inicio date='01-01-2018';
declare @fecha_fin date='12-01-2018';
declare @Airline_id varchar(10)='UX'
SELECT wks,
@Airline_id,
(SELECT Sum (Cast (nprints AS INT)) AS GPP
FROM dw_prints2 B1
WHERE ( B1.airline = @Airline_id )
AND B1.typeprint = 'GPP'
AND ( ( B1.eventtime >= @Fecha_Inicio )
AND ( B1.eventtime <= @Fecha_Fin ) )
AND A.wks = B1.wks) AS GPP,
(SELECT Sum (Cast (nprints AS INT)) AS BTP
FROM dw_prints2 C1
WHERE ( C1.airline = @Airline_id )
AND C1.typeprint = 'BTP'
AND ( ( C1.eventtime >= @Fecha_Inicio )
AND ( C1.eventtime <= @Fecha_Fin ) )
AND A.wks = C1.wks) AS BTP
FROM dw_prints2 A
GROUP BY wks
ORDER BY wks
returning:
wks Airline_id GPP BTP
MAD1AKB223 UX 1 NULL
MAD2AKB426 UX NULL NULL
MAD2AKB497 UX 1 NULL
MAD2AKB503 UX 2 1
However my intention is not to return WKS when sum is NULL for GPP and BTP. I mean:
wks Airline_id GPP BTP
MAD1AKB223 UX 1 NULL
MAD2AKB497 UX 1 NULL
MAD2AKB503 UX 2 1
thanks in advance for your help.
sql sql-server tsql
Need your help.
Having this table:
Airline WKS TypePrint nprints Eventtime
UX MAD2AKB503 BTP 1 2018-08-31 09:41:13.360
UX MAD2AKB503 GPP 1 2018-08-31 09:41:32.723
UX MAD2AKB503 GPP 1 2018-08-31 09:41:39.700
KLM MAD2AKB426 GPP 1 2018-08-31 09:46:03.727
KLM MAD2AKB426 GPP 1 2018-08-28 04:44:22.650
KLM MAD2AKB426 GPP 1 2018-08-28 04:44:29.000
UX MAD2AKB497 GPP 1 2018-08-29 06:03:24.517
KLM MAD2AKB426 GPP 1 2018-08-31 10:10:23.193
KLM MAD2AKB426 GPP 1 2018-08-31 10:10:30.837
UX MAD1AKB223 GPP 1 2018-08-05 20:01:57.857
I would like to sum nprints based in typeprint and Airline column by grouping by WKS. I tried with code as follows:
declare @fecha_inicio date='01-01-2018';
declare @fecha_fin date='12-01-2018';
declare @Airline_id varchar(10)='UX'
SELECT wks,
@Airline_id,
(SELECT Sum (Cast (nprints AS INT)) AS GPP
FROM dw_prints2 B1
WHERE ( B1.airline = @Airline_id )
AND B1.typeprint = 'GPP'
AND ( ( B1.eventtime >= @Fecha_Inicio )
AND ( B1.eventtime <= @Fecha_Fin ) )
AND A.wks = B1.wks) AS GPP,
(SELECT Sum (Cast (nprints AS INT)) AS BTP
FROM dw_prints2 C1
WHERE ( C1.airline = @Airline_id )
AND C1.typeprint = 'BTP'
AND ( ( C1.eventtime >= @Fecha_Inicio )
AND ( C1.eventtime <= @Fecha_Fin ) )
AND A.wks = C1.wks) AS BTP
FROM dw_prints2 A
GROUP BY wks
ORDER BY wks
returning:
wks Airline_id GPP BTP
MAD1AKB223 UX 1 NULL
MAD2AKB426 UX NULL NULL
MAD2AKB497 UX 1 NULL
MAD2AKB503 UX 2 1
However my intention is not to return WKS when sum is NULL for GPP and BTP. I mean:
wks Airline_id GPP BTP
MAD1AKB223 UX 1 NULL
MAD2AKB497 UX 1 NULL
MAD2AKB503 UX 2 1
thanks in advance for your help.
sql sql-server tsql
sql sql-server tsql
edited Nov 12 at 17:11
marc_s
570k12811001250
570k12811001250
asked Nov 12 at 15:44
trilero
52
52
add a case to where clause or do a sub select and exclude where those are null
– Brad
Nov 12 at 15:46
1
Not the same question (since you didn't mention you tried to useWHERE GPP is not null
or so), but still the same answers: 'invalid column name' while using the HAVING. Basically, either wrap the whole select in another, so you can filter by those virtual columns, GPP and BTP, or copy the entire condition to thehaving
clause. Given the complexity of the expressions, I would definitely do the first.
– GolezTrol
Nov 12 at 15:52
add a comment |
add a case to where clause or do a sub select and exclude where those are null
– Brad
Nov 12 at 15:46
1
Not the same question (since you didn't mention you tried to useWHERE GPP is not null
or so), but still the same answers: 'invalid column name' while using the HAVING. Basically, either wrap the whole select in another, so you can filter by those virtual columns, GPP and BTP, or copy the entire condition to thehaving
clause. Given the complexity of the expressions, I would definitely do the first.
– GolezTrol
Nov 12 at 15:52
add a case to where clause or do a sub select and exclude where those are null
– Brad
Nov 12 at 15:46
add a case to where clause or do a sub select and exclude where those are null
– Brad
Nov 12 at 15:46
1
1
Not the same question (since you didn't mention you tried to use
WHERE GPP is not null
or so), but still the same answers: 'invalid column name' while using the HAVING. Basically, either wrap the whole select in another, so you can filter by those virtual columns, GPP and BTP, or copy the entire condition to the having
clause. Given the complexity of the expressions, I would definitely do the first.– GolezTrol
Nov 12 at 15:52
Not the same question (since you didn't mention you tried to use
WHERE GPP is not null
or so), but still the same answers: 'invalid column name' while using the HAVING. Basically, either wrap the whole select in another, so you can filter by those virtual columns, GPP and BTP, or copy the entire condition to the having
clause. Given the complexity of the expressions, I would definitely do the first.– GolezTrol
Nov 12 at 15:52
add a comment |
1 Answer
1
active
oldest
votes
No need use subquery, just use conditional aggregations. And add HAVING to filter NULL results
SELECT wks,
@Airline_id as Airline,
Sum ( CASE WHEN typeprint = 'GPP'
THEN Cast (nprints AS INT)
END) AS GPP,
Sum ( CASE WHEN typeprint = 'BTP'
THEN Cast (nprints AS INT)
END) AS BTP,
FROM dw_prints2
WHERE Airline = @Airline_id
AND eventtime >= @Fecha_Inicio
AND eventtime <= @Fecha_Fin
GROUP BY wks
HAVING
Sum ( CASE WHEN typeprint = 'GPP'
THEN Cast (nprints AS INT)
END) IS NOT NULL
OR Sum ( CASE WHEN typeprint = 'BTP'
THEN Cast (nprints AS INT)
END) IS NOT NULL
ORDER BY wks
it doesn't work when BTP or GPP is null. It requieres to have both GPP and BTP. but it's certainly a good start!
– trilero
Nov 12 at 16:33
Yes, I fixed 20 minutes ago. ChangeAND
forOR
– Juan Carlos Oropeza
Nov 12 at 16:42
Just realized! Excellent, it works Now!
– trilero
Nov 12 at 16:44
It's much easier to filter before aggregation like :where nprints is not null and typeprint in ( 'GPP', BTP)
– dnoeth
Nov 12 at 16:57
I will check this possibility @dnoeth for performace as I am planning to move millions of rows...
– trilero
Nov 12 at 17:07
|
show 3 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265541%2fsum-based-on-column-value-with-no-null-results%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
No need use subquery, just use conditional aggregations. And add HAVING to filter NULL results
SELECT wks,
@Airline_id as Airline,
Sum ( CASE WHEN typeprint = 'GPP'
THEN Cast (nprints AS INT)
END) AS GPP,
Sum ( CASE WHEN typeprint = 'BTP'
THEN Cast (nprints AS INT)
END) AS BTP,
FROM dw_prints2
WHERE Airline = @Airline_id
AND eventtime >= @Fecha_Inicio
AND eventtime <= @Fecha_Fin
GROUP BY wks
HAVING
Sum ( CASE WHEN typeprint = 'GPP'
THEN Cast (nprints AS INT)
END) IS NOT NULL
OR Sum ( CASE WHEN typeprint = 'BTP'
THEN Cast (nprints AS INT)
END) IS NOT NULL
ORDER BY wks
it doesn't work when BTP or GPP is null. It requieres to have both GPP and BTP. but it's certainly a good start!
– trilero
Nov 12 at 16:33
Yes, I fixed 20 minutes ago. ChangeAND
forOR
– Juan Carlos Oropeza
Nov 12 at 16:42
Just realized! Excellent, it works Now!
– trilero
Nov 12 at 16:44
It's much easier to filter before aggregation like :where nprints is not null and typeprint in ( 'GPP', BTP)
– dnoeth
Nov 12 at 16:57
I will check this possibility @dnoeth for performace as I am planning to move millions of rows...
– trilero
Nov 12 at 17:07
|
show 3 more comments
No need use subquery, just use conditional aggregations. And add HAVING to filter NULL results
SELECT wks,
@Airline_id as Airline,
Sum ( CASE WHEN typeprint = 'GPP'
THEN Cast (nprints AS INT)
END) AS GPP,
Sum ( CASE WHEN typeprint = 'BTP'
THEN Cast (nprints AS INT)
END) AS BTP,
FROM dw_prints2
WHERE Airline = @Airline_id
AND eventtime >= @Fecha_Inicio
AND eventtime <= @Fecha_Fin
GROUP BY wks
HAVING
Sum ( CASE WHEN typeprint = 'GPP'
THEN Cast (nprints AS INT)
END) IS NOT NULL
OR Sum ( CASE WHEN typeprint = 'BTP'
THEN Cast (nprints AS INT)
END) IS NOT NULL
ORDER BY wks
it doesn't work when BTP or GPP is null. It requieres to have both GPP and BTP. but it's certainly a good start!
– trilero
Nov 12 at 16:33
Yes, I fixed 20 minutes ago. ChangeAND
forOR
– Juan Carlos Oropeza
Nov 12 at 16:42
Just realized! Excellent, it works Now!
– trilero
Nov 12 at 16:44
It's much easier to filter before aggregation like :where nprints is not null and typeprint in ( 'GPP', BTP)
– dnoeth
Nov 12 at 16:57
I will check this possibility @dnoeth for performace as I am planning to move millions of rows...
– trilero
Nov 12 at 17:07
|
show 3 more comments
No need use subquery, just use conditional aggregations. And add HAVING to filter NULL results
SELECT wks,
@Airline_id as Airline,
Sum ( CASE WHEN typeprint = 'GPP'
THEN Cast (nprints AS INT)
END) AS GPP,
Sum ( CASE WHEN typeprint = 'BTP'
THEN Cast (nprints AS INT)
END) AS BTP,
FROM dw_prints2
WHERE Airline = @Airline_id
AND eventtime >= @Fecha_Inicio
AND eventtime <= @Fecha_Fin
GROUP BY wks
HAVING
Sum ( CASE WHEN typeprint = 'GPP'
THEN Cast (nprints AS INT)
END) IS NOT NULL
OR Sum ( CASE WHEN typeprint = 'BTP'
THEN Cast (nprints AS INT)
END) IS NOT NULL
ORDER BY wks
No need use subquery, just use conditional aggregations. And add HAVING to filter NULL results
SELECT wks,
@Airline_id as Airline,
Sum ( CASE WHEN typeprint = 'GPP'
THEN Cast (nprints AS INT)
END) AS GPP,
Sum ( CASE WHEN typeprint = 'BTP'
THEN Cast (nprints AS INT)
END) AS BTP,
FROM dw_prints2
WHERE Airline = @Airline_id
AND eventtime >= @Fecha_Inicio
AND eventtime <= @Fecha_Fin
GROUP BY wks
HAVING
Sum ( CASE WHEN typeprint = 'GPP'
THEN Cast (nprints AS INT)
END) IS NOT NULL
OR Sum ( CASE WHEN typeprint = 'BTP'
THEN Cast (nprints AS INT)
END) IS NOT NULL
ORDER BY wks
edited Nov 12 at 16:47
trilero
52
52
answered Nov 12 at 15:57
Juan Carlos Oropeza
35.9k63775
35.9k63775
it doesn't work when BTP or GPP is null. It requieres to have both GPP and BTP. but it's certainly a good start!
– trilero
Nov 12 at 16:33
Yes, I fixed 20 minutes ago. ChangeAND
forOR
– Juan Carlos Oropeza
Nov 12 at 16:42
Just realized! Excellent, it works Now!
– trilero
Nov 12 at 16:44
It's much easier to filter before aggregation like :where nprints is not null and typeprint in ( 'GPP', BTP)
– dnoeth
Nov 12 at 16:57
I will check this possibility @dnoeth for performace as I am planning to move millions of rows...
– trilero
Nov 12 at 17:07
|
show 3 more comments
it doesn't work when BTP or GPP is null. It requieres to have both GPP and BTP. but it's certainly a good start!
– trilero
Nov 12 at 16:33
Yes, I fixed 20 minutes ago. ChangeAND
forOR
– Juan Carlos Oropeza
Nov 12 at 16:42
Just realized! Excellent, it works Now!
– trilero
Nov 12 at 16:44
It's much easier to filter before aggregation like :where nprints is not null and typeprint in ( 'GPP', BTP)
– dnoeth
Nov 12 at 16:57
I will check this possibility @dnoeth for performace as I am planning to move millions of rows...
– trilero
Nov 12 at 17:07
it doesn't work when BTP or GPP is null. It requieres to have both GPP and BTP. but it's certainly a good start!
– trilero
Nov 12 at 16:33
it doesn't work when BTP or GPP is null. It requieres to have both GPP and BTP. but it's certainly a good start!
– trilero
Nov 12 at 16:33
Yes, I fixed 20 minutes ago. Change
AND
for OR
– Juan Carlos Oropeza
Nov 12 at 16:42
Yes, I fixed 20 minutes ago. Change
AND
for OR
– Juan Carlos Oropeza
Nov 12 at 16:42
Just realized! Excellent, it works Now!
– trilero
Nov 12 at 16:44
Just realized! Excellent, it works Now!
– trilero
Nov 12 at 16:44
It's much easier to filter before aggregation like :
where nprints is not null and typeprint in ( 'GPP', BTP)
– dnoeth
Nov 12 at 16:57
It's much easier to filter before aggregation like :
where nprints is not null and typeprint in ( 'GPP', BTP)
– dnoeth
Nov 12 at 16:57
I will check this possibility @dnoeth for performace as I am planning to move millions of rows...
– trilero
Nov 12 at 17:07
I will check this possibility @dnoeth for performace as I am planning to move millions of rows...
– trilero
Nov 12 at 17:07
|
show 3 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53265541%2fsum-based-on-column-value-with-no-null-results%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
add a case to where clause or do a sub select and exclude where those are null
– Brad
Nov 12 at 15:46
1
Not the same question (since you didn't mention you tried to use
WHERE GPP is not null
or so), but still the same answers: 'invalid column name' while using the HAVING. Basically, either wrap the whole select in another, so you can filter by those virtual columns, GPP and BTP, or copy the entire condition to thehaving
clause. Given the complexity of the expressions, I would definitely do the first.– GolezTrol
Nov 12 at 15:52