Solved

query 2nd table based on results of 1st query

Posted on 2011-09-20
2
222 Views
Last Modified: 2012-05-12
table 1 --- master1   table2 --- custinput1

Based on the count of masterid I get from custinput1, I want to know how many posibilities are in master1.  Customer submits input file, which loads table custinput1.  The first query tells me how many records are linked to masterid in  custinput1.  I need to then take the masterid from the custinput1 file and compare how many more records are available in the master1 table.

This query tells me how many records are linked in custinput1:

select count(distinct masterid) from custinput1
  where exampleid = '3323'  and numberoflinked >0

Now I want to see how many are in master1. I'm trying...but it doesn't work., I get 0

select count (numberoflinked) from master1 where masterid in
(select count(distinct masterid) from custinput1
  where exampleid = '3323'  and numberoflinked >0)
0
Comment
Question by:abgail
[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 Comments
 
LVL 11

Accepted Solution

by:
rajvja earned 500 total points
ID: 36568213
Try this

select count (numberoflinked) from master1 where masterid in
(select distinct masterid from custinput1
  where exampleid = '3323'  and numberoflinked >0)
 
0
 
LVL 55

Expert Comment

by:Huseyin KAHRAMAN
ID: 36568324
please give a sample data from both tables and the result that you are looking for...
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

724 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