I WANT TO FIND UNIQUE ROWS FROM MY TABLE.MY SQL STAEMENT IS AS FOLLOWS:
Dim selectStatement As String _
= "SELECT DISTINCT Email, firstname,LastName, AddressLine1, City, County, PostalCode,InvoiceNumber,Delivery.UserID " _
& "FROM Delivery join Invoices on Delivery.UserID=Invoices.UserID " _
& "WHERE (firstname LIKE @firstname)AND (LastName LIKE @LastName)"
THIS DOES NOT RETURN UNIQUE ROWS SO I TEND TO USE LINQ METHOD TO REMOVE DUPLICATE. BUT I AM SURE IT CAN BE
According to the query statement you provided, I think the reason why you did not get the expected result may be:
Dim selectStatement As String _
= "SELECT DISTINCT Email, firstname,LastName, AddressLine1, City, County, PostalCode,InvoiceNumber,Delivery.UserID " _
& "FROM Delivery join Invoices on Delivery.UserID=Invoices.UserID " _
& "WHERE (firstname LIKE @firstname) AND (LastName LIKE @LastName)"
You used fuzzy query in the query statement, I am not sure if you understand its effect.
I am wondering whether the conditions should be:
WHERE (firstname = @firstname) AND (LastName = @LastName)
If I misunderstood something, could you provide more details?
Best regards,
Xudong Peng
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
282 Points
869 Posts
RETURN DISTINCT ROW IN SQL DATASET
Nov 26, 2020 06:44 PM|peterthegreat|LINK
I WANT TO FIND UNIQUE ROWS FROM MY TABLE.MY SQL STAEMENT IS AS FOLLOWS:
THIS DOES NOT RETURN UNIQUE ROWS SO I TEND TO USE LINQ METHOD TO REMOVE DUPLICATE. BUT I AM SURE IT CAN BE
FOUND DIRECT FROM TABLE?
Participant
1580 Points
907 Posts
Re: RETURN DISTINCT ROW IN SQL DATASET
Nov 27, 2020 01:10 AM|PaulTheSmith|LINK
Participant
1780 Points
557 Posts
Re: RETURN DISTINCT ROW IN SQL DATASET
Nov 27, 2020 06:38 AM|XuDong Peng|LINK
Hi peterthegreat,
According to the query statement you provided, I think the reason why you did not get the expected result may be:
You used fuzzy query in the query statement, I am not sure if you understand its effect.
I am wondering whether the conditions should be:
If I misunderstood something, could you provide more details?
Best regards,
Xudong Peng