View Full Version : Query doubt on access?


vinoth124
04-07-2009, 04:13 AM
Friends,

I have some doubt with reference to select query from a table in access database. Let me explain my scenerio clear...

Table Name: (Sample)
Data @ Sample table
SR ApplId Amount
101 AAA 500
102 BBB 600
101 CCC 800
103 DDD 560
101 AAA 590

I want to fetch all the rows other than this cobination SR:101 and SR:AAA.

Expected Output:
***************
SR ApplId Amount
102 BBB 600
101 CCC 800
103 DDD 560

Note : I tried with NotIn option but it is not giving up the 101;CCC;800 combination. Will you please give me some suggestion to resolve this issue.

Thanks in advance.

Thanks,
Vinoth R

DCrake
04-07-2009, 04:17 AM
Can you post a copy of your query sql statement.

ajetrumpet
04-07-2009, 04:19 AM
Expected output:SELECT * from SAMPLE
WHERE [SR] <> 101 AND [AppID] <> "AAA"

vinoth124
04-07-2009, 06:23 AM
Expected output:SELECT * from SAMPLE
WHERE [SR] <> 101 AND [AppID] <> "AAA"

I tried with this query but I recieved the Output as mentioned below...,

SR ApplId Amount
102 BBB 600
103 DDD 560

It is not giving the 3rd record i.e.,101;CCC;800.

My output should be like this....
SR ApplId Amount
102 BBB 600
101 CCC 800
103 DDD 560

ajetrumpet
04-07-2009, 06:37 AM
my apologeze. your instructions were not clear. either that, or I can't understand them. don't worry, it's probably my terrible ability to read. ;) :) Here is the next one:SELECT * from SAMPLE
WHERE [AppID] <> "AAA"

MSAccessRookie
04-07-2009, 06:50 AM
my apologeze. your instructions were not clear. either that, or I can't understand them. don't worry, it's probably my terrible ability to read. ;) :) Here is the next one:SELECT * from SAMPLE
WHERE [AppID] <> "AAA"


Like Adam, I was a little confused at the original request. This reply seems to give you what what you want. however, if the any of the following possible combinations is present, they will be ignored. If they are desired to be found, then the statement will need to be modified.

102 AAA 600
103 AAA 800
104 AAA 560
(etc)

gemma-the-husky
04-07-2009, 07:21 AM
i think its processing each half separately

try this (not tested) instead

SELECT * from SAMPLE
WHERE not ([SR] = 101 AND [AppID] = "AAA")

DCrake
04-07-2009, 11:39 PM
Why not add an extra column which is a concat of the other fields and use a like statement.