Exemplo n.º 1
0
        private void selectComprehensiveColumns(SQLStringBuilder queryString)
        {
            string[] columns = {"ld.learnerNumber",
                                "ld.Name",
                                "ld.Surname",
                                "ld.id",
                                "DATE(e.theRegDate)",
                                "ld.learnerStatus",
                                "d.divisionName as Division",
                                "ld.division as divisionAbrev"};

            queryString.Select(columns);
            queryString.From("learner_Details ld");
        }
Exemplo n.º 2
0
        private void selectCondensedColumns(SQLStringBuilder queryString)
        {
            string[] columns = { "ld.Division", "COUNT(ld.learnerKey)", "ld.learnerStatus" };

            queryString.Select(columns);
            queryString.From("learner_Details ld");
        }
Exemplo n.º 3
0
        private void includeRegDate(SQLStringBuilder queryString, bool filterByDate)
        {
            var subQuery = new SQLStringBuilder();
            subQuery.Scope("Registration Dates", () =>
            {
                string[] subColumns = { "learnerKey", "MIN(regDate) as theRegDate" };
                subQuery.Select(subColumns);
                subQuery.From("enrollments");
                subQuery.GroupBy("learnerKey");
                if (filterByDate)
                {
                    filterHavingByDate(subQuery);
                }
            });

            if (filterByDate)
            {
                queryString.RightJoin(String.Format("{0} as e", subQuery.ToString()), "e.LearnerKey = ld.LearnerKey");
            }
            else
            {
                queryString.LeftJoin(String.Format("{0} as e", subQuery.ToString()), "e.LearnerKey = ld.LearnerKey");
            }
        }