Solved

SQL Statment to match two tables in c#

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SYbase 4 31
Test the speeds on my PC Drives 12 48
Winform Module - What is the ASP.Net equiv 2 20
SQL Query assistance 16 25
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 opening and writing to files in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

773 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