troubleshooting Question

Need a query to return more results based on original match

Avatar of Samuel Baker
Samuel Baker asked on
Microsoft SQL ServerVisual Basic.NETSQL
12 Comments1 Solution304 ViewsLast Modified:
I have this working query below

Dim strSql = " SELECT * FROM JD Inner Join amipartnumbers on " &
            " amipartnumbers.oemitem=JD.OEMCurrentPartNumber WHERE " &
            " JD.OEMSubNumber = '" & enterNumber & "'" &
            " UNION SELECT * FROM IH Inner Join amipartnumbers on " & _
            " amipartnumbers.oemitem=IH.OEMCurrentPartNumber WHERE " & _
            " IH.OEMSubNumber= '" & enterNumber & "'"

Here are examples of the table

JD
OEMCurrentPartNumber    |   OEMDescription   |   OEMSubNumber
AR50865                                HOUSING                 AR50864
AR50865                                HOUSING                 AR50865
AR50865                                HOUSING                 R47736

amipartnumbers
Item            |   oemitem   |   Description
AMAR50865      AR50865      Center Tube, Axle

So when user searches for a number it finds it in JD.OEMSubNumber and joins JD.OEMCurrentPartNumber to amipartnumber.oemitem

What i would like to do it to bring back ALL OEMSubNumber's that match OEMCurrentPartNumber in JD Table.

Right now i have this filling my aspx.vb text boxes
Me.txtAMINumber.Text = FixNull(datatableFill.Rows(i)("Item"))
                Me.txtDescription.Text = FixNull(datatableFill.Rows(i)("Description"))
                Me.txtOEMPartNumber.Text = FixNull(datatableFill.Rows(i)("OEMCurrentPartNumber"))
                Me.txtOEMsubnumber1.Text = FixNull(datatableFill.Rows(i)("OEMSubNumber"))
                Me.txtOEMDescription.Text = FixNull(datatableFill.Rows(i)("OEMDescription"))

So i would like to make new textboxes called txtOEMsubnumber2, txtOEMsubnumber3 and so on and fill them with the matching (duplicate) numbers from OEMSubNumber

Make sense?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 12 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 12 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros