Hello,
I am trying to retrieve data from HeidiSQL. In the table M, the rows are mentioned in the code below are occuring 6 times but in the table N they are occuring only 4 times and i wanna join them but i am getting each entry 4 times and i want it only once. Can someone help me? Both have only one common column and that is "Prod_ Order No_"
*Code-BBCode eingefügt*
I am trying to retrieve data from HeidiSQL. In the table M, the rows are mentioned in the code below are occuring 6 times but in the table N they are occuring only 4 times and i wanna join them but i am getting each entry 4 times and i want it only once. Can someone help me? Both have only one common column and that is "Prod_ Order No_"
VB.NET-Quellcode
- Private Sub btnFAübernhmn_Click(sender As Object, e As EventArgs) Handles btnFAübernhmn.Click
- If DataGridView1.SelectedCells.Count > 0 Then
- Dim rowIndex As Integer = DataGridView1.SelectedCells(0).RowIndex
- Dim Prod_OrderNo_ As String = DataGridView1.Rows(rowIndex).Cells(0).Value
- 'msg for user to select atleast one row
- If String.IsNullOrEmpty(Prod_OrderNo_) Then
- MsgBox("Please select a non-empty row.", vbInformation)
- Return
- End If
- ' Open the database connection
- OpenNavDB()
- ClearDataGridView2()
- Dim Erpcmd2 As New SqlCommand
- Erpcmd2.Connection = NavDB
- 'WHERE dbo.[RPS24$Prod_ Order Rtng Qlty Meas_].[Routing No_] LIKE '01%' AND dbo.[RPS24$Prod_ Order Rtng Qlty Meas_].[Status]= 3
- 'from database
- Erpcmd2.CommandText = "SELECT M.[Operation No_],N.[No_],M.[Qlty Measure Code],M.[Description],M.[Min_ Value],M.[Max_ Value],M.[Mean Tolerance]
- FROM dbo.[RPS24$Prod_ Order Rtng Qlty Meas_] M
- INNER JOIN dbo.[RPS24$Prod_ Order Routing Line] N ON M.[Prod_ Order No_] = N.[Prod_ Order No_]
- where M.[Prod_ Order No_]= @Prod_OrderNo_ AND M.[Status]=N.[Status]
- ORDER BY [Operation No_]"
*Code-BBCode eingefügt*
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Marcus Gräfe“ ()