please help...

please see attached file for further explanation...

I'm a little confused.
abc is NOT greater than pqr.

I have a potential solution, but I need to ensure the design first.
Do you want a design that returns the records or the strings stating the results?

I'm a little confused.
abc is NOT greater than pqr.

oh...my bad...sorry...
disregard the pqr for abc...

I have a potential solution, but I need to ensure the design first.
Do you want a design that returns the records or the strings stating the results?

yes please....

Please let me know if this is overkill.
Also, I used a class to hold the data.
If the data comes from a specific source, you could easily change this:

Imports System.Linq
Imports System.Collections.Generic

Module Module1
   Public Class CTable
      Public name As String
      Public points As Integer

      Public Sub New()
         name = ""
         points = 0
      End Sub

      Public Sub New(ByVal name As String, ByVal points As Integer)
         Me.name = name
         Me.points = points
      End Sub
   End Class

   Sub Main()

      Dim lstTable1 As New List(Of CTable) From
      {
         New CTable("abc", 10011),
         New CTable("def", 10022),
         New CTable("ghi", 10033)
      }

      Dim lstTable2 As New List(Of CTable) From
      {
         New CTable("jkl", 10000),
         New CTable("mno", 15550),
         New CTable("pqr", 10029)
      }

      Dim lst_strResult As List(Of String) =
      (
         From s In
         (
            From rowA In lstTable1
            From rowB In lstTable2
            Where rowB.points < rowA.points
            Select New With {.key = rowA.name, .value = rowB.name}
         ).ToLookup(Function(k) k.key, Function(v) v.value)
         Select (s.Key & " is greater than " & String.Join(" and ", s.ToArray()))
      ).ToList()

      lst_strResult.ForEach(Sub(s) Console.WriteLine(s))
   End Sub
End Module

Please let me know if this is overkill.
Also, I used a class to hold the data.
If the data comes from a specific source, you could easily change this:

Imports System.Linq
Imports System.Collections.Generic

Module Module1
   Public Class CTable
      Public name As String
      Public points As Integer

      Public Sub New()
         name = ""
         points = 0
      End Sub

      Public Sub New(ByVal name As String, ByVal points As Integer)
         Me.name = name
         Me.points = points
      End Sub
   End Class

   Sub Main()

      Dim lstTable1 As New List(Of CTable) From
      {
         New CTable("abc", 10011),
         New CTable("def", 10022),
         New CTable("ghi", 10033)
      }

      Dim lstTable2 As New List(Of CTable) From
      {
         New CTable("jkl", 10000),
         New CTable("mno", 15550),
         New CTable("pqr", 10029)
      }

      Dim lst_strResult As List(Of String) =
      (
         From s In
         (
            From rowA In lstTable1
            From rowB In lstTable2
            Where rowB.points < rowA.points
            Select New With {.key = rowA.name, .value = rowB.name}
         ).ToLookup(Function(k) k.key, Function(v) v.value)
         Select (s.Key & " is greater than " & String.Join(" and ", s.ToArray()))
      ).ToList()

      lst_strResult.ForEach(Sub(s) Console.WriteLine(s))
   End Sub
End Module

please see my another post with gis

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.