[AccessD] Query sub query not working
Paul Hartland
paul.hartland at googlemail.com
Tue Jul 23 13:17:53 CDT 2019
Your alias t is on the field & not the table...
SELECT [tbl Dual Completion Hierarchy].PID, [tbl Dual Completion
Hierarchy].Hierarchy AS t
FROM [tbl Dual Completion Hierarchy]
Should be
SELECT [tbl Dual Completion Hierarchy].PID, [tbl Dual Completion
Hierarchy].Hierarchy
FROM [tbl Dual Completion Hierarchy] as t
Paul
On Tue, 23 Jul 2019, 19:09 Kaup, Chester, <Chester_Kaup at kindermorgan.com>
wrote:
> This query is asking for input rather than generating any. I have reviewed
> the table and name fields and must be missing something. Below is the SQL
> and a portion of the source table. Thanks for your assistance
>
> SELECT [tbl Dual Completion Hierarchy].PID, [tbl Dual Completion
> Hierarchy].Hierarchy AS t
> FROM [tbl Dual Completion Hierarchy]
> WHERE ((([tbl Dual Completion Hierarchy].Hierarchy) In (SELECT Max([tbl
> Dual Completion Hierarchy].Hierarchy) from [tbl Dual Completion Hierarchy]
> as t2 where t2.PID =t.PID)));
>
> tbl Dual Completion Hierarchy
>
> PID
>
> Hierarchy
>
> 42415343720000
>
> 18
>
> 42415343720001
>
> 18
>
> 42415343820000
>
> 5
>
> 42415343820001
>
> 5
>
> 42415343910000
>
> 5
>
> 42415343910001
>
> 5
>
> 42415344030000
>
> 18
>
> 42415344030001
>
> 18
>
> 42415344070000
>
> 17
>
> 42415344070001
>
> 2
>
> 42415344070001
>
> 3
>
> 42415344080000
>
> 5
>
> 42415344080000
>
> 13
>
> 42415344080001
>
> 5
>
> 42415344080001
>
> 13
>
>
> --
> 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