Solved

SQL Statment to match two tables in c#

Posted on 2013-12-05
6
73 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
Comment Utility
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
Comment Utility
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
Comment Utility
can you give us dummy data  and schema and your required result?
0
 

Author Comment

by:awolarczuk
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
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.

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now