Skip to content

Instantly share code, notes, and snippets.

SELECT product_id, td.the_date, SUM(qty)
FROM fact_sales sf
LEFT JOIN `olap_time_dimensions` td ON sf.`olap_time_dimension_id`=td.id
WHERE td.`the_month`='07'
GROUP BY product_id, td.the_date
ORDER BY product_id, td.the_date;
@egi
egi / 0_reuse_code.js
Last active August 29, 2015 14:08
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@egi
egi / MD5.cs
Last active August 29, 2015 14:01 — forked from irmansulaeman41/RC4.cs
Implementasi detect msisdn on windows phone. Known issues: silverlight does not support md5 hashing and native rc4.
//Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Text;
// **************************************************************
// * Raw implementation of the MD5 hash algorithm
// * from RFC 1321.
// *
// * Written By: Reid Borsuk and Jenny Zheng
// * Copyright (c) Microsoft Corporation. All rights reserved.
@egi
egi / gist:1370233
Created November 16, 2011 14:53 — forked from chartjes/gist:1370214
Need help with a MySQL query
I have the following query:
SELECT COUNT( DISTINCT ( brand.id )), MONTH(u.created_at)
FROM brand
LEFT JOIN brand_admin_group bag ON brand.id = bag.brand_id
LEFT JOIN brand_admin_group_membership bagm ON bag.id = bagm.brand_admin_group_id
LEFT JOIN user u ON bagm.user_id = u.id
GROUP BY MONTH(u.created_at)
Results look like this: