A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

SQL Help Needed - Revisited



 
 
Thread Tools Display Modes
  #1  
Old May 9th, 2008, 03:48 PM posted to microsoft.public.access.queries
Carl
external usenet poster
 
Posts: 473
Default 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  
Old May 9th, 2008, 04:10 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default 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  
Old May 9th, 2008, 04:27 PM posted to microsoft.public.access.queries
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default 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  
Old May 9th, 2008, 05:17 PM posted to microsoft.public.access.queries
Carl
external usenet poster
 
Posts: 473
Default 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  
Old May 9th, 2008, 05:58 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 11:29 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.