[AccessD] Query trouble

Kaup, Chester Chester_Kaup at kindermorgan.com
Tue Oct 8 16:04:10 CDT 2019


Perfect. Thank you.

-----Original Message-----
From: AccessD [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Ryan W
Sent: Tuesday, October 08, 2019 3:52 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] Query trouble

[This email message was received from the Internet and came from outside of Kinder Morgan]


You want AND between your criteria, not OR I believe. 

Sent from my iPhone

> On Oct 8, 2019, at 3:24 PM, Kaup, Chester <Chester_Kaup at kindermorgan.com> wrote:
> 
> I am trying to use both a not like and not equal statement in the same query. Either criteria work correctly by itself. When I use both nothing is excluded. What might I be doing wrong? Below is the SQL statement. Thanks.
> 
> SELECT dbo_DSS_LastStatus.PID, dbo_DSS_LastStatus.Completion_Name, dbo_DSS_LastStatus.Status, [tbl Petra Current Status Copy].[Sym Code] INTO [tbl Petra and DSS Status]
> FROM (dbo_DSS_LastStatus INNER JOIN dbo_DSS_CompletionMaster ON dbo_DSS_LastStatus.PID = dbo_DSS_CompletionMaster.PID) INNER JOIN [tbl Petra Current Status Copy] ON dbo_DSS_CompletionMaster.ParentPID = [tbl Petra Current Status Copy].[UWI (APINum)]
> GROUP BY dbo_DSS_LastStatus.PID, dbo_DSS_LastStatus.Completion_Name, dbo_DSS_LastStatus.Status, [tbl Petra Current Status Copy].[Sym Code]
> HAVING ((([tbl Petra Current Status Copy].[Sym Code]) Not Like "PA*")) OR ((([tbl Petra Current Status Copy].[Sym Code])<>"P&A"));
> -- 
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com



More information about the AccessD mailing list