This OFFSET FETCH command passes validation but produces no results?sql ORDER BY multiple values in specific order?how to produce multiple rows into 1 column value or sql statement with comma seperated in T-sqlSQL group by with multiple conditionsHow to populate a collection property from SqlDataReader?How to select data from a table which has inter-related data?Oracle offset fetch as optionalSQL Return every row even if Null valuesSQL Server 2012 paging order by an unknown columnSQL Server Join - With INFO_SCHEMA informationSQL Server : Offset Rows Fetch Next with parent child relationshiops
Spoken encryption
How can I make sure my players' decisions have consequences?
Is my employer paying me fairly? Going from 1099 to W2
How were the LM astronauts supported during the moon landing and ascent? What were the max G's on them during these phases?
How do campaign rallies gain candidates votes?
What should I say when a company asks you why someone (a friend) who was fired left?
Print sums of all subsets
(1 of 11: Numberlink) What is Pyramid Cult's Favorite Activity?
How may I concisely assign different values to a variable, depending on another variable?
Can two figures have the same area, perimeter, and same number of segments have different shape?
Memory capability and powers of 2
Can the Artificer's infusions stack? Returning weapon + radiant weapon?
Replacing tongue and groove floorboards: but can't find a match
Iterate over non-const variables in C++
On the strategic interest of giving long lasting stock orders
What was the rationale behind 36 bit computer architectures?
Convert a string like 4h53m12s to a total number of seconds in JavaScript
Why no ";" after "do" in sh loops?
401(k) investment after being fired. Do I own it?
Is it correct to translate English noun adjuncts into adjectives?
What is the meaning of "you has the wind of me"?
Is there anything wrong with Thrawn?
Why are so many countries still in the Commonwealth?
Does academia have a lazy work culture?
This OFFSET FETCH command passes validation but produces no results?
sql ORDER BY multiple values in specific order?how to produce multiple rows into 1 column value or sql statement with comma seperated in T-sqlSQL group by with multiple conditionsHow to populate a collection property from SqlDataReader?How to select data from a table which has inter-related data?Oracle offset fetch as optionalSQL Return every row even if Null valuesSQL Server 2012 paging order by an unknown columnSQL Server Join - With INFO_SCHEMA informationSQL Server : Offset Rows Fetch Next with parent child relationshiops
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have to connect accounts to users, and in doing so I have ensure I'm selecting the right account to ensure eligibility and do this with multiple accounts. The following code passes validation but yields no results.
I already have a list of the CustomerNumbers on the table that are the PK.
SELECT
x.CustomerNumber,
a.ACC_AccountId
FROM Eligibles x
LEFT JOIN
ACCOUNTS a
ON x.CustomerNumber = a.ACC_CustomerNumber
ORDER BY a.ACC_LIVEcode ASC,
a.ACC_Limit DESC,
a.ACC_Amount DESC
OFFSET 0 ROWS
FETCH FIRST 1 ROWS ONLY
I am not getting any Account ID's to populate, whereas nearly everyone should have one.
sql sql-server salesforce-marketing-cloud
add a comment |
I have to connect accounts to users, and in doing so I have ensure I'm selecting the right account to ensure eligibility and do this with multiple accounts. The following code passes validation but yields no results.
I already have a list of the CustomerNumbers on the table that are the PK.
SELECT
x.CustomerNumber,
a.ACC_AccountId
FROM Eligibles x
LEFT JOIN
ACCOUNTS a
ON x.CustomerNumber = a.ACC_CustomerNumber
ORDER BY a.ACC_LIVEcode ASC,
a.ACC_Limit DESC,
a.ACC_Amount DESC
OFFSET 0 ROWS
FETCH FIRST 1 ROWS ONLY
I am not getting any Account ID's to populate, whereas nearly everyone should have one.
sql sql-server salesforce-marketing-cloud
add a comment |
I have to connect accounts to users, and in doing so I have ensure I'm selecting the right account to ensure eligibility and do this with multiple accounts. The following code passes validation but yields no results.
I already have a list of the CustomerNumbers on the table that are the PK.
SELECT
x.CustomerNumber,
a.ACC_AccountId
FROM Eligibles x
LEFT JOIN
ACCOUNTS a
ON x.CustomerNumber = a.ACC_CustomerNumber
ORDER BY a.ACC_LIVEcode ASC,
a.ACC_Limit DESC,
a.ACC_Amount DESC
OFFSET 0 ROWS
FETCH FIRST 1 ROWS ONLY
I am not getting any Account ID's to populate, whereas nearly everyone should have one.
sql sql-server salesforce-marketing-cloud
I have to connect accounts to users, and in doing so I have ensure I'm selecting the right account to ensure eligibility and do this with multiple accounts. The following code passes validation but yields no results.
I already have a list of the CustomerNumbers on the table that are the PK.
SELECT
x.CustomerNumber,
a.ACC_AccountId
FROM Eligibles x
LEFT JOIN
ACCOUNTS a
ON x.CustomerNumber = a.ACC_CustomerNumber
ORDER BY a.ACC_LIVEcode ASC,
a.ACC_Limit DESC,
a.ACC_Amount DESC
OFFSET 0 ROWS
FETCH FIRST 1 ROWS ONLY
I am not getting any Account ID's to populate, whereas nearly everyone should have one.
sql sql-server salesforce-marketing-cloud
sql sql-server salesforce-marketing-cloud
asked Mar 26 at 16:46
WaystoneWaystone
61 bronze badge
61 bronze badge
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
In an ascending sort, NULL
s are first. So, you get the mismatches first. Instead, add an expression so the matches are first:
SELECT x.CustomerNumber, a.ACC_AccountId
FROM Eligibles x LEFT JOIN
ACCOUNTS a
ON x.CustomerNumber = a.ACC_CustomerNumber
ORDER BY (CASE WHEN ACC_CustomerNumber IS NOT NULL THEN 1 ELSE 0 END),
aa.ACC_LIVEcode ASC, a.ACC_Limit DESC, a.ACC_Amount DESC
OFFSET 0 ROWS
FETCH FIRST 1 ROWS ONLY
Thank you, I did try this with no luck. I should also mention that are no null values in this case and the LIVEcode depicts the status of that account ranging from 1 (Active) to 9 (Inactive)
– Waystone
Mar 26 at 17:39
@Waystone . . . TheNULL
values come from theLEFT JOIN
.
– Gordon Linoff
Mar 27 at 0:54
add a comment |
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%2f55362304%2fthis-offset-fetch-command-passes-validation-but-produces-no-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
In an ascending sort, NULL
s are first. So, you get the mismatches first. Instead, add an expression so the matches are first:
SELECT x.CustomerNumber, a.ACC_AccountId
FROM Eligibles x LEFT JOIN
ACCOUNTS a
ON x.CustomerNumber = a.ACC_CustomerNumber
ORDER BY (CASE WHEN ACC_CustomerNumber IS NOT NULL THEN 1 ELSE 0 END),
aa.ACC_LIVEcode ASC, a.ACC_Limit DESC, a.ACC_Amount DESC
OFFSET 0 ROWS
FETCH FIRST 1 ROWS ONLY
Thank you, I did try this with no luck. I should also mention that are no null values in this case and the LIVEcode depicts the status of that account ranging from 1 (Active) to 9 (Inactive)
– Waystone
Mar 26 at 17:39
@Waystone . . . TheNULL
values come from theLEFT JOIN
.
– Gordon Linoff
Mar 27 at 0:54
add a comment |
In an ascending sort, NULL
s are first. So, you get the mismatches first. Instead, add an expression so the matches are first:
SELECT x.CustomerNumber, a.ACC_AccountId
FROM Eligibles x LEFT JOIN
ACCOUNTS a
ON x.CustomerNumber = a.ACC_CustomerNumber
ORDER BY (CASE WHEN ACC_CustomerNumber IS NOT NULL THEN 1 ELSE 0 END),
aa.ACC_LIVEcode ASC, a.ACC_Limit DESC, a.ACC_Amount DESC
OFFSET 0 ROWS
FETCH FIRST 1 ROWS ONLY
Thank you, I did try this with no luck. I should also mention that are no null values in this case and the LIVEcode depicts the status of that account ranging from 1 (Active) to 9 (Inactive)
– Waystone
Mar 26 at 17:39
@Waystone . . . TheNULL
values come from theLEFT JOIN
.
– Gordon Linoff
Mar 27 at 0:54
add a comment |
In an ascending sort, NULL
s are first. So, you get the mismatches first. Instead, add an expression so the matches are first:
SELECT x.CustomerNumber, a.ACC_AccountId
FROM Eligibles x LEFT JOIN
ACCOUNTS a
ON x.CustomerNumber = a.ACC_CustomerNumber
ORDER BY (CASE WHEN ACC_CustomerNumber IS NOT NULL THEN 1 ELSE 0 END),
aa.ACC_LIVEcode ASC, a.ACC_Limit DESC, a.ACC_Amount DESC
OFFSET 0 ROWS
FETCH FIRST 1 ROWS ONLY
In an ascending sort, NULL
s are first. So, you get the mismatches first. Instead, add an expression so the matches are first:
SELECT x.CustomerNumber, a.ACC_AccountId
FROM Eligibles x LEFT JOIN
ACCOUNTS a
ON x.CustomerNumber = a.ACC_CustomerNumber
ORDER BY (CASE WHEN ACC_CustomerNumber IS NOT NULL THEN 1 ELSE 0 END),
aa.ACC_LIVEcode ASC, a.ACC_Limit DESC, a.ACC_Amount DESC
OFFSET 0 ROWS
FETCH FIRST 1 ROWS ONLY
answered Mar 26 at 17:05
Gordon LinoffGordon Linoff
838k38 gold badges343 silver badges449 bronze badges
838k38 gold badges343 silver badges449 bronze badges
Thank you, I did try this with no luck. I should also mention that are no null values in this case and the LIVEcode depicts the status of that account ranging from 1 (Active) to 9 (Inactive)
– Waystone
Mar 26 at 17:39
@Waystone . . . TheNULL
values come from theLEFT JOIN
.
– Gordon Linoff
Mar 27 at 0:54
add a comment |
Thank you, I did try this with no luck. I should also mention that are no null values in this case and the LIVEcode depicts the status of that account ranging from 1 (Active) to 9 (Inactive)
– Waystone
Mar 26 at 17:39
@Waystone . . . TheNULL
values come from theLEFT JOIN
.
– Gordon Linoff
Mar 27 at 0:54
Thank you, I did try this with no luck. I should also mention that are no null values in this case and the LIVEcode depicts the status of that account ranging from 1 (Active) to 9 (Inactive)
– Waystone
Mar 26 at 17:39
Thank you, I did try this with no luck. I should also mention that are no null values in this case and the LIVEcode depicts the status of that account ranging from 1 (Active) to 9 (Inactive)
– Waystone
Mar 26 at 17:39
@Waystone . . . The
NULL
values come from the LEFT JOIN
.– Gordon Linoff
Mar 27 at 0:54
@Waystone . . . The
NULL
values come from the LEFT JOIN
.– Gordon Linoff
Mar 27 at 0:54
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
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.
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%2f55362304%2fthis-offset-fetch-command-passes-validation-but-produces-no-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