If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
SQL Help Needed - Revisited
I posted yesterday but did a poor job of explaining my task. I'm trying
again. My apologies. Thank you all who tried to help. I need a query that will do the following. Return only the records that satisfies these 2 criteria. 1. UnderlyingName not in this list ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC') And TradeType not equal to Pip 2. UnderlyingName not in the list above And Account not equal to Public. Thank you again for your help. |
#2
|
|||
|
|||
SQL Help Needed - Revisited
Your explanation still confuses me.
Do you want records that are not in the list and TradeType not "PIP" PLUS the records that are not in the List and Account is Not Public The problem that I see is that if that is what you want you could get some records that are not in the list but that are "PIP", but have an Account that is not Public and records that are not "PIP", but have an Account that is Public. You might try the following WHERE NOT(UnderLyingName In ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC') AND (Account = 'Public' Or TradeType = 'PIP')) That shoule return recods that are not in the list, Not TradeType="PIP" and not Account equal to Public. John Spencer Access MVP 2002-2005, 2007-2008 Center for Health Program Development and Management University of Maryland Baltimore County carl wrote: I posted yesterday but did a poor job of explaining my task. I'm trying again. My apologies. Thank you all who tried to help. I need a query that will do the following. Return only the records that satisfies these 2 criteria. 1. UnderlyingName not in this list ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC') And TradeType not equal to Pip 2. UnderlyingName not in the list above And Account not equal to Public. Thank you again for your help. |
#3
|
|||
|
|||
SQL Help Needed - Revisited
I posted the below yesterday but no response --
With this set of data is the Return column correct? UnderlyingSymbol TradeType Return A Pip Yes AA Pipe No AAPL Pip Yes BIG Pip No AMD Pip Yes AMGN Pip Yes AMZN Pip Yes Or is backwards? -- KARL DEWEY Build a little - Test a little "carl" wrote: I posted yesterday but did a poor job of explaining my task. I'm trying again. My apologies. Thank you all who tried to help. I need a query that will do the following. Return only the records that satisfies these 2 criteria. 1. UnderlyingName not in this list ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC') And TradeType not equal to Pip 2. UnderlyingName not in the list above And Account not equal to Public. Thank you again for your help. |
#4
|
|||
|
|||
SQL Help Needed - Revisited
Thank you all again.
My criteria has changed a bit. I tried to put togther an SQL to reflect. Is there a way to use multiple Where statements inthe same SQL. In this case, I need an OR operator between the two Where. SELECT BTA_Trades_April.* FROM BTA_Trades_April WHERE (((BTA_Trades_April.UnderlyingSymbol) In ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC','COP','CSCO','DELL','DI A','DNDN','EBAY','EEM','EMC','F','FCX','FLEX','GE' ,'GM','GS','HAL','HD','INTC','IWM','JAVA','JPM','L EH','MER','MNX','MO','MOT','MSFT','NEM','NYX','OIH ','PFE','QCOM','QQQQ','RIMM','RIO','SBUX','SMH','S NDK','SPY','T','TGT','TXN','VLO','VZ','WFMI','WM', 'WMT','XLE','XLF','XOM','YHOO')) AND ((BTA_Trades_April.TradeType)'Pip')) Where Not ((BTA_Trades_April.UnderlyingSymbol) In ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC','COP','CSCO','DELL','DI A','DNDN','EBAY','EEM','EMC','F','FCX','FLEX','GE' ,'GM','GS','HAL','HD','INTC','IWM','JAVA','JPM','L EH','MER','MNX','MO','MOT','MSFT','NEM','NYX','OIH ','PFE','QCOM','QQQQ','RIMM','RIO','SBUX','SMH','S NDK','SPY','T','TGT','TXN','VLO','VZ','WFMI','WM', 'WMT','XLE','XLF','XOM','YHOO')) AND ((BTA_Trades_April.AccountType)'PublicCustomer') ); "KARL DEWEY" wrote: I posted the below yesterday but no response -- With this set of data is the Return column correct? UnderlyingSymbol TradeType Return A Pip Yes AA Pipe No AAPL Pip Yes BIG Pip No AMD Pip Yes AMGN Pip Yes AMZN Pip Yes Or is backwards? -- KARL DEWEY Build a little - Test a little "carl" wrote: I posted yesterday but did a poor job of explaining my task. I'm trying again. My apologies. Thank you all who tried to help. I need a query that will do the following. Return only the records that satisfies these 2 criteria. 1. UnderlyingName not in this list ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC') And TradeType not equal to Pip 2. UnderlyingName not in the list above And Account not equal to Public. Thank you again for your help. |
#5
|
|||
|
|||
SQL Help Needed - Revisited
SELECT BTA_Trades_April.*
FROM BTA_Trades_April WHERE ((((BTA_Trades_April.UnderlyingSymbol) In ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC','COP','CSCO','DELL','DI A','DNDN','EBAY','EEM','EMC','F','FCX','FLEX','GE' ,'GM','GS','HAL','HD','INTC','IWM','JAVA','JPM','L EH','MER','MNX','MO','MOT','MSFT','NEM','NYX','OIH ','PFE','QCOM','QQQQ','RIMM','RIO','SBUX','SMH','S NDK','SPY','T','TGT','TXN','VLO','VZ','WFMI','WM', 'WMT','XLE','XLF','XOM','YHOO')) AND ((BTA_Trades_April.TradeType)'Pip'))) OR (Not ((BTA_Trades_April.UnderlyingSymbol) In ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC','COP','CSCO','DELL','DI A','DNDN','EBAY','EEM','EMC','F','FCX','FLEX','GE' ,'GM','GS','HAL','HD','INTC','IWM','JAVA','JPM','L EH','MER','MNX','MO','MOT','MSFT','NEM','NYX','OIH ','PFE','QCOM','QQQQ','RIMM','RIO','SBUX','SMH','S NDK','SPY','T','TGT','TXN','VLO','VZ','WFMI','WM', 'WMT','XLE','XLF','XOM','YHOO')) AND ((BTA_Trades_April.AccountType)'PublicCustomer') )); Changed second where to OR and then added parentheses around each set of criteria. John Spencer Access MVP 2002-2005, 2007-2008 Center for Health Program Development and Management University of Maryland Baltimore County carl wrote: Thank you all again. My criteria has changed a bit. I tried to put togther an SQL to reflect. Is there a way to use multiple Where statements inthe same SQL. In this case, I need an OR operator between the two Where. SELECT BTA_Trades_April.* FROM BTA_Trades_April WHERE (((BTA_Trades_April.UnderlyingSymbol) In ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC','COP','CSCO','DELL','DI A','DNDN','EBAY','EEM','EMC','F','FCX','FLEX','GE' ,'GM','GS','HAL','HD','INTC','IWM','JAVA','JPM','L EH','MER','MNX','MO','MOT','MSFT','NEM','NYX','OIH ','PFE','QCOM','QQQQ','RIMM','RIO','SBUX','SMH','S NDK','SPY','T','TGT','TXN','VLO','VZ','WFMI','WM', 'WMT','XLE','XLF','XOM','YHOO')) AND ((BTA_Trades_April.TradeType)'Pip')) Where Not ((BTA_Trades_April.UnderlyingSymbol) In ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC','COP','CSCO','DELL','DI A','DNDN','EBAY','EEM','EMC','F','FCX','FLEX','GE' ,'GM','GS','HAL','HD','INTC','IWM','JAVA','JPM','L EH','MER','MNX','MO','MOT','MSFT','NEM','NYX','OIH ','PFE','QCOM','QQQQ','RIMM','RIO','SBUX','SMH','S NDK','SPY','T','TGT','TXN','VLO','VZ','WFMI','WM', 'WMT','XLE','XLF','XOM','YHOO')) AND ((BTA_Trades_April.AccountType)'PublicCustomer') ); "KARL DEWEY" wrote: I posted the below yesterday but no response -- With this set of data is the Return column correct? UnderlyingSymbol TradeType Return A Pip Yes AA Pipe No AAPL Pip Yes BIG Pip No AMD Pip Yes AMGN Pip Yes AMZN Pip Yes Or is backwards? -- KARL DEWEY Build a little - Test a little "carl" wrote: I posted yesterday but did a poor job of explaining my task. I'm trying again. My apologies. Thank you all who tried to help. I need a query that will do the following. Return only the records that satisfies these 2 criteria. 1. UnderlyingName not in this list ('A','AA','AAPL','AIG','AMD','AMGN','AMZN','BAC',' BMY','BSC','C','CAT','CFC') And TradeType not equal to Pip 2. UnderlyingName not in the list above And Account not equal to Public. Thank you again for your help. |
Thread Tools | |
Display Modes | |
|
|