Solved

SQL Statment to match two tables in c#

Posted on 2013-12-05
6
88 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

Question has a verified solution.

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

Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use while-loops in the C programming language.

623 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