Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Change 1

Status
Not open for further replies.

fileman1

Technical User
Feb 7, 2013
152
GB
I am trying to modify this SQL for a different database, the function being the same for grouping on Keywords, but wanting different data for the list that it's the rows source.

The Query:
Code:
MySql = "SELECT A.* FROM MAIN A INNER JOIN " _
          & "(SELECT M.ID1 FROM MAIN M INNER JOIN KEYWORD K ON M.ID1 = K.ID1" _
          & " WHERE K.KeywordName IN (" & Mid(strList1, 2) & ")" _
          & " GROUP BY M.ID1 HAVING Count(*)=" & Me!LIST3.ItemsSelected.Count _
          & ") B ON A.ID1=B.ID1"

The fields wanted:
Code:
   ' MySql = "SELECT MAIN.ID1, MAIN.[Brief Issue Summary], MAIN.Status FROM MAIN;"

Tried various guessed permutations but tied up in knots

 
Oh Dear, egg on face. It was all there, just had not enough columns set in list box. Now works fine
 
So, you wanted this ?
Code:
MySql = "SELECT A.ID1, A.[Brief Issue Summary], A.Status FROM MAIN A INNER JOIN " _
          & "(SELECT M.ID1 FROM MAIN M INNER JOIN KEYWORD K ON M.ID1 = K.ID1" _
          & " WHERE K.KeywordName IN (" & Mid(strList1, 2) & ")" _
          & " GROUP BY M.ID1 HAVING Count(*)=" & Me!LIST3.ItemsSelected.Count _
          & ") B ON A.ID1=B.ID1"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thankyou PHV, yes that's correct. Now the part A.* makes sense as being * all fields in A. Regards


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top