Hi Everyone,
I am having a little trouble with an SQL query, let me try to explain.
This is the query that I am running:
now this query works fine and returns the Cards I want, but I want to search for 2 or more different Cards on the same customer, but of the SAME card type. The problem is that I want to run the same query again with an AND statement (to look for another different CARD to go with the first one), but I want it to remember the output from the first query, so that it doesn’t use that to satisfy the query.
So, at the moment it would read:
But the problem with the above query is that it doesn’t remember the output from the first part, so its basically just running the same query twice.
Is there anyway to remember the output from the first query, so that it doesn’t carry over to the second query?
Thanks alot of looking
I am having a little trouble with an SQL query, let me try to explain.
This is the query that I am running:
Code:
select * from CUSTOMER where CARD in (select CARD from CREDIT_CARD where CARD_TYPE='A')
now this query works fine and returns the Cards I want, but I want to search for 2 or more different Cards on the same customer, but of the SAME card type. The problem is that I want to run the same query again with an AND statement (to look for another different CARD to go with the first one), but I want it to remember the output from the first query, so that it doesn’t use that to satisfy the query.
So, at the moment it would read:
Code:
select * from CUSTOMER where CARD in (select CARD from CREDIT_CARD where CARD_TYPE='A') AND CARD in (select CARD from CREDIT_CARD where CARD_TYPE='A')
But the problem with the above query is that it doesn’t remember the output from the first part, so its basically just running the same query twice.
Is there anyway to remember the output from the first query, so that it doesn’t carry over to the second query?
Thanks alot of looking
Comment