?
Solved

Sql query -Results from 2 tables

Posted on 2011-10-14
1
Medium Priority
?
289 Views
Last Modified: 2012-08-13
Hi,
I need to write a query which checks whether a string is not present in table1 ,then look for it in table2.

sql1: SQL = "SELECT FormTable FROM " & TABForms  WHERE " & ctUcase & "(FORMTABLE) LIKE " & (CalcTable.ToUpper & WildChr, ctText)
if  FormTable  does not exists in FormTable then check it in Usertable
 sql2: SQL = " SELECT table_name   FROM user_tables where    table_name  LIKE " & (CalcTable.ToUpper & WildChr, ctText)

Any help appreciated.
 
0
Comment
Question by:RIAS
1 Comment
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 36968319
can't you just UNION them?

SQL = "SELECT FormTable FROM " & TABForms  WHERE " & ctUcase & "(FORMTABLE) LIKE " & (CalcTable.ToUpper & WildChr, ctText)
SQL = SQL + " UNION "
SQL = SQL + " SELECT table_name   FROM user_tables where    table_name  LIKE " & (CalcTable.ToUpper & WildChr, ctText)
0

Featured Post

Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
MSSQL DB-maintenance also needs implementation of multiple activities. However, unprecedented errors can hamper the database management. In that case, deploying Stellar SQL Database Toolkit ensures fast and accurate database and backup repair as wel…
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question