Solved

SQL Statment to match two tables in c#

Posted on 2013-12-05
6
80 Views
Last Modified: 2015-05-28
Hi there
I am trying to get this statmnet to work to match two table in called Alerts and table name in there called First name and the 2nd table names and the table inside of that names, what i am trying to do is match the data from first name to names i have kinds got it working but it is showing data that doesnt match at all and i cant work out why

SELECT        Title
FROM            names
WHERE        EXISTS
                             (SELECT        [last name]
                               FROM            Alerts
                               WHERE        (ID =name.ID))
0
Comment
Question by:awolarczuk
  • 2
  • 2
6 Comments
 
LVL 4

Accepted Solution

by:
ItWorked earned 500 total points
ID: 39697868
How about doing as
1) with In clause :

SELECT        Title
FROM            names
WHERE       Title in (
                                SELECT        [last name]
                                FROM            Alerts
                                WHERE        (ID =name.ID))
                               )

2) Using Exist clause
SELECT        Title
FROM            names
WHERE        EXISTS
                             (SELECT        [last name]
                               FROM            Alerts
                               WHERE        (ID =name.ID)) and names.Title=alerts.Title

Please refer Exists and In clause
0
 

Author Comment

by:awolarczuk
ID: 39697898
thanks mate
i have tried both of them and i am getting a error error Message: No Value given for one or more required parameters
0
 
LVL 4

Expert Comment

by:ItWorked
ID: 39697916
can you give us dummy data  and schema and your required result?
0
 

Author Comment

by:awolarczuk
ID: 39697918
cool mate i ave got past that error now getting another error message invalid memo, OLE, Or Hyperlink Object in subquery '[last name]
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

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

This article describes how to use the timestamp of existing data in a database to allow Tableau to calculate the prior work day instead of relying on case statements or if statements to calculate the days of the week.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.

829 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