sql statement

tirso

Active member
Joined
Nov 15, 2006
Messages
31
Programming Experience
1-3
Hi! to all, I want to select in my database those multiple value in a Field and put the result in my datagrid. The problem is I want to display the table like TABLE 1. I have already the code to get the frequency of chiban No but see the result in TABLE 2 followed on my code.

TABLE 1
Source Data (DataBase)
Chiban Frequency
12345
12345
12346
12357
12357

Result (DataGrid View)
Chiban Frequency
12345 2
12357 2

VB.NET:
objCommand = New OleDbCommand("SELECT * from TableData where chiban" & _
            " In (select chiban from tabledata GROUP BY Chiban HAVING" & _
            " Count(*)>1) ORDER by chiban", objConnection)
TABLE 2.
Chiban Frequency
12345
12345
12357
12357

Thanks in advance

Tirso
 
Hi lingsn,

Another one question, how about if I want to display another field not only chiban like table below

Chiban ID EDABAN FREQUENCY
12345 1 3-1 2


Thanks,
Tirso
 
Back
Top