Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Not sure how

Author  Topic 

jeffksr
Starting Member

4 Posts

Posted - 2004-08-17 : 13:16:10
in the following select how do I get any data from the exists select??


SELECT TOP 100 PERCENT dbo.SPONPF.SPNMLN AS Name, dbo.SPONPF.SPNIDN AS ID, dbo.SPONPF.SPNALP AS [Fee Paid], dbo.v_firm_size.firm_size
FROM dbo.SPONPF INNER JOIN
dbo.v_firm_size ON dbo.v_firm_size.indfrm = dbo.SPONPF.SPNIDN
WHERE (dbo.SPONPF.SPNSPX = 2005) AND (dbo.SPONPF.SPNALP <> 0) AND EXISTS
(SELECT casdte,casitm,caswho
FROM v_purchases
WHERE casitm = 'FRMSPON' AND caswho = spnidn AND casdte >= 20040601)
ORDER BY dbo.v_firm_size.firm_size DESC

Seventhnight
Master Smack Fu Yak Hacker

2878 Posts

Posted - 2004-08-17 : 13:17:14
Exists does not return data... it simply returns a boolean (true|false)

What are you trying to accomplish?

Corey
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-17 : 13:17:49
Could you provide an example of what the data looks like and what you want the returned result set to look like?

Tara
Go to Top of Page

jeffksr
Starting Member

4 Posts

Posted - 2004-08-17 : 13:27:24
I want the first data set AND the column casdte from the check on existence. If I try to join I get a run time error
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-17 : 13:32:58
Then add another JOIN. JOIN to v_purchases.

We really need to see your table structure and sample data to help.

Tara
Go to Top of Page

jeffksr
Starting Member

4 Posts

Posted - 2004-08-17 : 13:46:27
quote:
Originally posted by tduggan

Then add another JOIN. JOIN to v_purchases.

We really need to see your table structure and sample data to help.

Tara

Go to Top of Page

jeffksr
Starting Member

4 Posts

Posted - 2004-08-17 : 13:47:08
quote:
Originally posted by jeffksr

quote:
Originally posted by tduggan

Then add another JOIN. JOIN to v_purchases.

We really need to see your table structure and sample data to help.

Tara





I'm tryint to retrieve the transaction date if there is a transaction.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-08-17 : 13:48:41
That isn't enough information for us to help. We need to see the table structures of all tables involved in the query as well as sample data for those tables and expected result set using that sample data.

Tara
Go to Top of Page
   

- Advertisement -