asp.net 2.0
llblgenpro 2
self-servicing
Hello,
I am trying to convert this:
select unique tbl_student_visa_transfer.transfer_school, a.c, b.c
from tbl_student_visa_transfer
left join
(select transfer_school, count(transfer_school) c from tbl_student_visa_transfer
where completion is null
group by transfer_school) a
on a.transfer_school = tbl_student_visa_transfer.transfer_school
left join
(select transfer_school, count(transfer_school) c from tbl_student_visa_transfer
where completion is not null
group by transfer_school) b
on b.transfer_school = tbl_student_visa_transfer.transfer_schoo
l
and here is my code:
Dim fields As New ResultsetFields(3)
fields.DefineField(STUDENT_VISA_TRANSFERFields.TRANSFER_SCHOOL, 0, "items", "a")
fields.DefineField(STUDENT_VISA_TRANSFERFields.TRANSFER_SCHOOL, 1, "transferIn", "b", AggregateFunction.Count)
fields.DefineField(STUDENT_VISA_TRANSFERFields.TRANSFER_SCHOOL, 2, "transferOut", "c", AggregateFunction.Count)
Dim groupByClause As IGroupByCollection = New GroupByCollection()
groupByClause.Add(fields(0))
groupByClause.Add(fields(1))
groupByClause.Add(fields(2))
Dim filter As IPredicateExpression = New PredicateExpression()
filter.Add(PredicateFactory.CompareValue(STUDENT_VISA_TRANSFERFieldIndex.COMPLETION, ComparisonOperator.Equal, DBNull.Value, "b"))
filter.Add(PredicateFactory.CompareValue(STUDENT_VISA_TRANSFERFieldIndex.COMPLETION, ComparisonOperator.NotEqual, DBNull.Value, "c"))
Dim relations As IRelationCollection = New RelationCollection()
relations.Add(STUDENT_VISA_TRANSFEREntity.Relations.STUDENT_VISA_TRANSFEREntityUsingTRANSFER_ID, "a", "b", JoinHint.Left)
relations.Add(STUDENT_VISA_TRANSFEREntity.Relations.STUDENT_VISA_TRANSFEREntityUsingTRANSFER_ID, "a", "c", JoinHint.Left)
Dim dynamicList As New DataTable()
Dim dao As New DaoClasses.TypedListDAO()
dao.GetMultiAsDataTable(fields, dynamicList, 0, Nothing, filter, relations, True, groupByClause, Nothing, 0, 0)
There is nothing return from the dynamic list. Does anyone know if I made any mistakes?
Thanks for your help!!!