not in and not exists

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have been trying to use two queries for getting values
of cur_doc_no of eq
topekacurdocno table whose values are not their in eq
wichitavouchers table's
voucher.
i used not in and not exists.eq wichitavouchers table is
odbc connected.when
iam runnign the both quries it is asking for passwrod
continously.wher as this
is not the same problem with other queries using this
table.
my queries

SELECT [EQ TOPEKA CURDOCNUM].TRANS_YR, [EQ TOPEKA
CURDOCNUM].FISCAL_MONTH, [EQ
TOPEKA CURDOCNUM].FUND, [EQ TOPEKA CURDOCNUM].MO_INDEX,
[EQ TOPEKA
CURDOCNUM].TRANS_CODE, [EQ TOPEKA CURDOCNUM].CUR_DOC_NO,
[EQ TOPEKA
CURDOCNUM].SumOfWARRANT_AMOUNT
FROM [EQ TOPEKA CURDOCNUM]
WHERE [EQ TOPEKA CURDOCNUM].CUR_DOC_NO NOT IN (SELECT
[EQ WICHITA
VOUCHERS].VOUCHER_NO FROM [EQ WICHITA VOUCHERS]

WHERE ([EQ TOPEKA CURDOCNUM].FUND=[EQ WICHITA
VOUCHERS].FUND) And ([EQ TOPEKA
CURDOCNUM].FISCAL_MONTH=[EQ WICHITA VOUCHERS].ACCT_PERIOD)
And ([EQ TOPEKA
CURDOCNUM].TRANS_YR=[EQ WICHITA VOUCHERS].FISCAL_YEAR)
And ([EQ TOPEKA
CURDOCNUM].MO_INDEX=[EQ WICHITA VOUCHERS].BUDGET_UNIT));

NOT EXISTS

SELECT [EQ TOPEKA CURDOCNUM].TRANS_YR, [EQ TOPEKA
CURDOCNUM].FISCAL_MONTH, [EQ
TOPEKA CURDOCNUM].FUND, [EQ TOPEKA CURDOCNUM].MO_INDEX,
[EQ TOPEKA
CURDOCNUM].TRANS_CODE, [EQ TOPEKA CURDOCNUM].CUR_DOC_NO,
[EQ TOPEKA
CURDOCNUM].SumOfWARRANT_AMOUNT
FROM [EQ TOPEKA CURDOCNUM]
WHERE NOT EXISTS (SELECT [EQ WICHITA VOUCHERS].VOUCHER_NO
FROM [EQ WICHITA
VOUCHERS] WHERE ([EQ TOPEKA CURDOCNUM].CUR_DOC_NO=[EQ
WICHITA
VOUCHERS].VOUCHER_NO));

I WUD BE GREATFUL TO U IF U CUD HELP ME OUT WITH THIS
PROBLEM
REGARDS
DEEPTHI
 
i have been trying to use two queries for getting values
of cur_doc_no of eq
topekacurdocno table whose values are not their in eq
wichitavouchers table's
voucher.

Try a "Frustrated Outer Join" query instead: use a Left Join to the
wichitavouchers table, and a criterion of IS NULL on the joining
field.

If you have tables with data (cities) in the table name you're in for
real trouble. Data should be stored in table fields, not in table
names!
 
Back
Top