-
-
Save remzmike/e41e831670dad3fbe1b5330083af9514 to your computer and use it in GitHub Desktop.
60 second where clause builder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 60 second where clauses | |
string Or(string a, string b) | |
{ | |
return "( " + a + " OR " + b + " )"; | |
} | |
string And(string a, string b) | |
{ | |
return "( " + a + " AND " + b + " )"; | |
} | |
string Eq(string a, string b) | |
{ | |
return "( " + a + " = " + b + " )"; | |
} | |
void Main() | |
{ | |
// code like this | |
var s = Or( | |
And( | |
Eq("A","@A0"), | |
Eq("B","@B0") | |
), | |
And( | |
Eq("A","@A1"), | |
Eq("B","@B1") | |
) | |
); | |
Console.WriteLine(s); | |
// that makes a string like this | |
//(NPA = @NPA0 and NXX = @NXX0) OR (NPA = @NPA1 and NXX = @NXX1) | |
} | |
// Define other methods and classes here |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment