nguyentrunghoadh > 29-06-17, 03:13 PM
ongke0711 > 29-06-17, 04:12 PM
Option Explicit
Function LienKetDong(IndexField As Variant)
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String
Dim RowList As String
Set db = CurrentDb()
strSQL = "SELECT Mon FROM Table1 WHERE [Ma] = """ & IndexField & """"
Set rs = db.OpenRecordset(strSQL, dbOpenSnapshot)
If Not rs.EOF Then
rs.MoveFirst
End If
Do While Not rs.EOF
RowList = RowList & rs(0) & ", "
rs.MoveNext
Loop
LienKetDong = Left(RowList, Len(RowList) - 2)
End Function
SELECT Table1.Ma, Table1.HoTen, LienKetDong([Ma]) AS DayMon, Sum(Table1.TietDay) AS TongSoTiet, Table1.ChuNhiem
FROM Table1
GROUP BY Table1.Ma, Table1.HoTen, LienKetDong([Ma]), Table1.ChuNhiem;
nguyentrunghoadh > 17-08-17, 09:11 AM
ongke0711 > 17-08-17, 01:00 PM