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)
 SQL SRV Query question

Author  Topic 

vree
Starting Member

30 Posts

Posted - 2006-01-12 : 18:16:27
I have an SQL Srv db; that runs a website and online meeting registration application. I did not design the application so forgive me for asking a question to try to get around what appears to be poor design.

There is a back end - which sets up the meetings. And a front end which accepts registrations.

I use this subquery to tell me who is in the db that does not have a record in the payments table.(and it works fine for "all records") This may happen because a person aborts the registration process.

I would like to know who is in the db and have not paid filtered by meetingId. I am not having any success.

SELECT * FROM dbo.regEntity
WHERE (entId NOT IN
(SELECT entId FROM regEntPayment))

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-01-12 : 18:25:11
If table regEntPayment allows nulls in column entId, you should do this.

SELECT
*
FROM
dbo.regEntity
WHERE
entId NOT IN
(
SELECT
entId
FROM
regEntPayment
WHERE
entId is not null
)





CODO ERGO SUM
Go to Top of Page

vree
Starting Member

30 Posts

Posted - 2006-01-12 : 18:42:59
Oh thank you; but no it doesnt allow nulls. Sorry I wasn't clear about that - that is why it is hard for me to tell if a company who is in the db; has actually paid; and for which meeting.

if i can provide you with any info i will be happy to.
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-01-13 : 02:13:26
Post some sample data and the result you want

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -