Skip to content

Instantly share code, notes, and snippets.

View cjonstrup's full-sized avatar
💭
I may be slow to respond.

Carsten Jonstrup cjonstrup

💭
I may be slow to respond.
View GitHub Profile
@KennyEliasson
KennyEliasson / NaturalSort.cs
Created August 21, 2012 09:27
Natural Sort c#
public class NaturalSortComparer : IComparer<string>, IDisposable
{
private bool isAscending;
public NaturalSortComparer(bool inAscendingOrder = true)
{
this.isAscending = inAscendingOrder;
}
public int Compare(string x, string y)

Cool MySQL Query Stuff

This gist is a way of collecting cool, more unusual MySQL query techniques and tips and tricks.

ifnull()

use this to convert column values to more useful defaults if they are null. can be used in formulas, order by etc.

in this example, using ifnull() avoids sums using columns that have null values ending up as null