Home > Software engineering >  SQL three columns of the same data is given the same number
SQL three columns of the same data is given the same number

Time:11-30

Such as three columns of data column B column column C
A B C
1 001 a
1 002 b
1 001 a
1 002 b
1 002 b
2 001 a
If A B C three columns of data are given the same number same run results such as:
A B C NO
1 001 a 01
1 002 02 b
1 001 a 01
1 002 02 b
1 002 02 b
2 001 a 03
Ask ace to help

CodePudding user response:

Don't say database
The oracle's words below can be realized, essentially a try should also go
 
Select ta. *, TB. NO
The from
The table as ta,
(select a, b, c row_number () over (partition by null order by null) as the NO from table group by a, b, c) as TB
Where ta. A=TB. And a ta. B=TB. B and ta. C
c=TB.


CodePudding user response:

In the form to add a ListBox, can be set to invisible,
 Option Explicit 
Private Declare Function SendMessagebyString Lib _
"User32" Alias "SendMessageA" (ByVal hWND As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As Long As String)

Private Const LB_FINDSTRINGEXACT=& amp; H1A2

Private Sub Command1_Click ()
Dim cn As ADODB library. The Connection, the rs As the ADODB library you
Dim strLine As String, n As Long

Set the cn=New ADODB. Connection
Set the rs=New ADODB. You

Cn. The Open ". The Provider=Microsoft Jet. The OLEDB. 4.0; Data Source=c: \ test \ test. The MDB;"
Rs. Open the "select * from table8", cn, adOpenKeyset, adLockOptimistic
List1. Clear

EOF
Do Until the rs.StrLine=rs! A. & amp; Rs! B & amp; Rs! C
N=SendMessagebyString (List1. HWND LB_FINDSTRINGEXACT, 1, strLine)
If n=1 Then
List1. AddItem strLine
Rs! No=List1. NewIndex + 1
The Else
Rs! No=n + 1
End the If

Rs. Update
Rs. MoveNext
Loop
End Sub

CodePudding user response:

The access... I've always thought this was a disabling the database name

CodePudding user response:

I so far, there has been no written than it powerful database system, so is not convenient to comment,
  • Related