I don't know if this is the right forum, but here goes.
Is it possible to match/compare two sql-queries?
I have an SQL-query which includes some "Or" statements and another which includes some "AND" statements.
I'm quering in the same table in the same db, but I really want to get one output where I get the intersection between query 1 and 2. You can sort of say "3 = 1 AND 2". Get m drift?
Some somewhat a beginner in this SQL stuff so I don't know if all this can be described in one SQL-query?
These are the SQL-queries:
strSQL = "SELECT * FROM tblCBtest WHERE"
strSQL = strSQL & " (cb LIKE '" & strTypen & "')"
strSQL = strSQL & " or (cb2 LIKE '" & strTypen & "')"
strSQL = strSQL & " or (cb3 LIKE '" & strTypen & "')"
'-------------------
str2SQL = "SELECT * FROM tblCBtest WHERE"
str2SQL = str2SQL & " (Amt LIKE '" & strAmt & "')"
str2SQL = str2SQL & " AND (Postnr LIKE '%" & strPostnr & "%')"
str2SQL = str2SQL & " AND (Byen LIKE '%" & strByen & "%')"
str2SQL = str2SQL & " AND (Navn LIKE '%" & strNavn & "%')"
==============
Thanks
Rasmus
Is it possible to match/compare two sql-queries?
I have an SQL-query which includes some "Or" statements and another which includes some "AND" statements.
I'm quering in the same table in the same db, but I really want to get one output where I get the intersection between query 1 and 2. You can sort of say "3 = 1 AND 2". Get m drift?
Some somewhat a beginner in this SQL stuff so I don't know if all this can be described in one SQL-query?
These are the SQL-queries:
strSQL = "SELECT * FROM tblCBtest WHERE"
strSQL = strSQL & " (cb LIKE '" & strTypen & "')"
strSQL = strSQL & " or (cb2 LIKE '" & strTypen & "')"
strSQL = strSQL & " or (cb3 LIKE '" & strTypen & "')"
'-------------------
str2SQL = "SELECT * FROM tblCBtest WHERE"
str2SQL = str2SQL & " (Amt LIKE '" & strAmt & "')"
str2SQL = str2SQL & " AND (Postnr LIKE '%" & strPostnr & "%')"
str2SQL = str2SQL & " AND (Byen LIKE '%" & strByen & "%')"
str2SQL = str2SQL & " AND (Navn LIKE '%" & strNavn & "%')"
==============
Thanks
Rasmus