Click here to Skip to main content
15,564,399 members
Home / Discussions / Database
   

Database

 
GeneralRe: Order by several static string values, error "Conversion failed when converting the varchar value 'FX' to data type int" [sort of solved] Pin
jsc4222-Nov-22 11:31
professionaljsc4222-Nov-22 11:31 
GeneralRe: Order by several static string values, error "Conversion failed when converting the varchar value 'FX' to data type int" [sort of solved] Pin
jkirkerx22-Nov-22 11:50
professionaljkirkerx22-Nov-22 11:50 
GeneralRe: Order by several static string values, error "Conversion failed when converting the varchar value 'FX' to data type int" [sort of solved] Pin
jsc4223-Nov-22 0:26
professionaljsc4223-Nov-22 0:26 
GeneralRe: Order by several static string values, error "Conversion failed when converting the varchar value 'FX' to data type int" [sort of solved] Pin
jkirkerx23-Nov-22 7:11
professionaljkirkerx23-Nov-22 7:11 
QuestionCan any body share the schema database for security and share. Pin
Nguyễn Tuấn Anh 9216-Nov-22 6:40
Nguyễn Tuấn Anh 9216-Nov-22 6:40 
AnswerRe: Can any body share the schema database for security and share. Pin
Sam Hobbs6-Nov-22 11:05
Sam Hobbs6-Nov-22 11:05 
AnswerRe: Can any body share the schema database for security and share. Pin
jschell14-Nov-22 7:49
jschell14-Nov-22 7:49 
QuestionHow to avoid duplicate records while using a UNION - SOLVED Pin
Richard Andrew x6428-Oct-22 16:50
professionalRichard Andrew x6428-Oct-22 16:50 
I have two SELECT statements joined with a UNION keyword.

There's a problem if both SELECT statements return the same record thus causing it to appear twice in the result set.

Is there any easy way to make the two SELECT statements mutually exclusive, so that if a record appears in the first one, it should not appear in the second one?

SQL
SELECT Column1, Column2, (SUBQUERY1) [SOMEDATA]
FROM TABLE1
WHERE CRITERIA1 IS TRUE

UNION

SELECT Column1, Column2, (SUBQUERY2) [SOMEDIFFERENTDATA]
FROM TABLE1
WHERE CRITERIA2 IS TRUE

SOLUTION: (This solution brought to you by rubber duck debugging.)

SQL
SELECT Column1, Column2, COALESCE((SUBQUERY2), (SUBQUERY1)) [SOMEDATA]
FROM TABLE1
WHERE CRITERIA1 IS TRUE
OR CRITERIA2 IS TRUE




The difficult we do right away...
...the impossible takes slightly longer.


modified 29-Oct-22 11:31am.

AnswerRe: How to avoid duplicate records while using a UNION - SOLVED Pin
Richard Deeming31-Oct-22 0:01
mveRichard Deeming31-Oct-22 0:01 
GeneralRe: How to avoid duplicate records while using a UNION - SOLVED Pin
Richard Andrew x6431-Oct-22 2:13
professionalRichard Andrew x6431-Oct-22 2:13 
AnswerRe: How to avoid duplicate records while using a UNION - SOLVED Pin
Andrea Simonassi2-Nov-22 20:55
Andrea Simonassi2-Nov-22 20:55 
AnswerRe: How to avoid duplicate records while using a UNION - SOLVED Pin
PIEBALDconsult6-Nov-22 6:54
professionalPIEBALDconsult6-Nov-22 6:54 
GeneralRe: How to avoid duplicate records while using a UNION - SOLVED Pin
Richard Andrew x646-Nov-22 7:56
professionalRichard Andrew x646-Nov-22 7:56 
QuestionAzure Synapse Where myString like '%Pattern1%Pattern2%' Pin
j11codep3-Oct-22 16:02
j11codep3-Oct-22 16:02 
AnswerRe: Azure Synapse Where myString like '%Pattern1%Pattern2%' Pin
CHill606-Oct-22 2:41
mveCHill606-Oct-22 2:41 
QuestionSimple Unique Identity Value Pin
Richard Andrew x6430-Sep-22 11:30
professionalRichard Andrew x6430-Sep-22 11:30 
AnswerRe: Simple Unique Identity Value Pin
Richard Deeming2-Oct-22 23:04
mveRichard Deeming2-Oct-22 23:04 
GeneralRe: Simple Unique Identity Value Pin
Richard Andrew x646-Oct-22 3:00
professionalRichard Andrew x646-Oct-22 3:00 
AnswerRe: Simple Unique Identity Value Pin
CHill606-Oct-22 2:59
mveCHill606-Oct-22 2:59 
GeneralRe: Simple Unique Identity Value Pin
Richard Andrew x646-Oct-22 3:01
professionalRichard Andrew x646-Oct-22 3:01 
Questionibtogo64.dll error Pin
Dhyanga25-Sep-22 7:06
Dhyanga25-Sep-22 7:06 
AnswerRe: ibtogo64.dll error Pin
Richard MacCutchan25-Sep-22 7:51
mveRichard MacCutchan25-Sep-22 7:51 
GeneralRe: ibtogo64.dll error Pin
Dhyanga25-Sep-22 8:52
Dhyanga25-Sep-22 8:52 
GeneralRe: ibtogo64.dll error Pin
Richard MacCutchan25-Sep-22 9:03
mveRichard MacCutchan25-Sep-22 9:03 
GeneralRe: ibtogo64.dll error Pin
Dhyanga25-Sep-22 9:15
Dhyanga25-Sep-22 9:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.