Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
Code Golf

Return to Answer

Commonmark migration
Source Link

#MS-SQL, 137 bytes

MS-SQL, 137 bytes

SELECT v.value+s.value
FROM STRING_SPLIT('A-2-3-4-5-6-7-8-9-10-J-Q-K','-')v,STRING_SPLIT('H-S-D-C--','-')s
WHERE s.value>''OR v.value='J'

An array of values in SQL is returned as separate query rows. Uses the STRING_SPLIT function introduced in SQL 2016.

It includes the jokers by adding two "blank string" suits to take advantage of the existing "J" for Jack, then filtering out rows we don't want. Shorter than using UNION ALL statements to add the jokers.

#MS-SQL, 137 bytes

SELECT v.value+s.value
FROM STRING_SPLIT('A-2-3-4-5-6-7-8-9-10-J-Q-K','-')v,STRING_SPLIT('H-S-D-C--','-')s
WHERE s.value>''OR v.value='J'

An array of values in SQL is returned as separate query rows. Uses the STRING_SPLIT function introduced in SQL 2016.

It includes the jokers by adding two "blank string" suits to take advantage of the existing "J" for Jack, then filtering out rows we don't want. Shorter than using UNION ALL statements to add the jokers.

MS-SQL, 137 bytes

SELECT v.value+s.value
FROM STRING_SPLIT('A-2-3-4-5-6-7-8-9-10-J-Q-K','-')v,STRING_SPLIT('H-S-D-C--','-')s
WHERE s.value>''OR v.value='J'

An array of values in SQL is returned as separate query rows. Uses the STRING_SPLIT function introduced in SQL 2016.

It includes the jokers by adding two "blank string" suits to take advantage of the existing "J" for Jack, then filtering out rows we don't want. Shorter than using UNION ALL statements to add the jokers.

Source Link
BradC
  • 6.9k
  • 1
  • 15
  • 34

#MS-SQL, 137 bytes

SELECT v.value+s.value
FROM STRING_SPLIT('A-2-3-4-5-6-7-8-9-10-J-Q-K','-')v,STRING_SPLIT('H-S-D-C--','-')s
WHERE s.value>''OR v.value='J'

An array of values in SQL is returned as separate query rows. Uses the STRING_SPLIT function introduced in SQL 2016.

It includes the jokers by adding two "blank string" suits to take advantage of the existing "J" for Jack, then filtering out rows we don't want. Shorter than using UNION ALL statements to add the jokers.

AltStyle によって変換されたページ (->オリジナル) /