experts please help on querying and counting the frequency of data, i want to count the number of data appearance then put it on like this:

Name----Lastname----Relationship----Freq
Egie----Tayag-------Brother---------2

i will place the result on a report counting the number of a person's visit on the theme park. TIA ^_^

SELECT relfirstname, rellastname, relrel, count(*) AS kamote FROM RelativeTable WHERE effectivedate = #" & frmNew.DTPicker2 & "# AND empnumber = '" & frmNew.empnotxt.Text & "' GROUP BY rellastname

I think this should work:

SELECT 
    relfirstname, rellastname, relrel, count(*) AS kamote 
FROM
    RelativeTable 
WHERE
    effectivedate = '" & frmNew.DTPicker2.Value.ToString() & "' AND 
    empnumber = '" & frmNew.empnotxt.Text & "' 
GROUP BY 
    relfirstname, rellastname, relrel

thanks, ^_^

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.