Solved

SQL Statment to match two tables in c#

Posted on 2013-12-05
6
85 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

Is Your Team Achieving Their Full Potential?

74% of employees feel they are not achieving their full potential. With Linux Academy, not only will you strengthen your team's core competencies but also their knowledge of of the newest IT topics.

With new material every week, we'll make sure that you stay ahead of the game.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them 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.

734 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