I have table tblConsentQuestion with Questions
intID nvcText bitActive17 Question1 True18 Question2 True19 Question3 Falseand table tblConsentData with the questions for every customer
intID intCustomerID bitConsent intIDQuestion 14 1 False 1915 1 True 18WHERE tblConsentQuestion.intID = tblConsentData.intIDQuestion
I would like to retrieve in a VB.net dataset
All
tblConsentDatafor a specific Customer ie two records withintID=14and15All active (
bitActive = true) records intblConsentQuestionWHERE tblConsentData.intIDQuestion <> tblConsentQuestion.intID, in this case onlyintID=17record (in addition to the two records)
Output should be
Question3 FalseQuestion2 TrueQuestion1 NullI tried something like
str = "Select tblConsentQuestion.intID, bitConsent, nvcText" & fungGetLangId() & " AS nvcqText " _ & " From tblConsentData " _ & " Left OUTER JOIN tblConsentQuestion " _ & " On tblConsentData.intIDQuestion = tblConsentQuestion.intID " _ & " where tblConsentData.intCustomerID = " & intCustomerID & " " _ & " UNION ALL " _ & " Select tblConsentQuestion.intID, -1, nvcText" & fungGetLangId() & " " _ & " From tblConsentQuestion " _ & " Left OUTER JOIN tblConsentData " _ & " On tblConsentData.intIDQuestion = tblConsentQuestion.intID " _ & " WHERE(tblConsentQuestion.bitActive = 'True') "and I receive All active records in tblConsentQuestion, whereas I should not receive record with intID = 18, which exists in