Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Need help Access queries ===> SQL queries
I am converting the following Access queries to Oracle Sql queries. I
have no problems
converting the tables and field names to Oracle standards. I have set
up the procedure
to accept the proper parameters input. For you oracle only people in the
where statements like this (([Domtable].[Industry Code])=[Select Ind
Code]) the
field [Select Ind Code] on the right is a parameter passed to the
procedure.
My problem is How would I represent the following Access queries in Sql.
In access they are queries that essentially run other queries. So to run
the
whole thing in ACCESS I would run SELECTED_TYPE2 to get my results
I am especially confused by query SELECTED_TYPE2B which is joined with
another query SELECT_TYPE2
This access query
Thanks the queries in question are all listed below
Access query name: SELECTED_TYPE2
SELECT DISTINCTROW Selected_Type2a.* FROM Selected_Type2a
UNION
SELECT DISTINCTROW Selected_Type2b.* FROM Selected_Type2b;
Access query name: SELECTED_TYPE2A
SELECT DISTINCTROW [Level]+1 AS [Next Level], 0 AS [Split Set],
[Domtable].[Primary Key], [Domtable].[Industry Code],
[Domtable].[Primary Key] AS [Parent PK Selected]
FROM [Domtable]
WHERE ((([Domtable].[Primary Key])=(select[MinOfPrimary Key] from
Select_Type2))
AND (([Domtable].[Industry Code])=[Select Ind Code]) AND (([Domtable].Level)=[Select Level]) AND (([Domtable].[Split Set])=[Select Split Set]) AND (([Domtable].[Parent PK Selected])=[Select Parent PK]));
Access query name: SELECTED_TYPE2B
SELECT DISTINCTROW [Level]+1 AS [Next Level], 0 AS [Split Set],
[Domtable].[Primary Key], [Domtable].[Industry Code],
Select_Type2.[MinOfPrimary Key] AS [Parent PK Selected]
FROM Select_Type2, [Domtable] INNER JOIN [Initdata] ON
([Domtable].[Industry Code] = [Initdata].[Industry Code]) AND
([Domtable].[Primary Key] = [Initdata].[Primary Key])
WHERE ((([Domtable].[Industry Code])=[Select Ind Code]) AND
(([Domtable].Level)=[Select Level]) AND (([Domtable].[Split
Set])=[Select Split Set]) AND (([Domtable].[Parent PK Selected])=[Select
Parent PK]) AND (([Initdata].F2)="C"));
Access query name: SELECT_TYPE2
SELECT DISTINCTROW Min([Domtable].[Primary Key]) AS [MinOfPrimary Key]
FROM [Initdata] INNER JOIN [Domtable] ON ([Initdata].[Industry Code] =
[Domtable].[Industry Code]) AND ([Initdata].[Primary Key] =
[Domtable].[Primary Key])
WHERE ((([Domtable].[Industry Code])=[Select Ind Code])
AND (([Initdata].F2)=[Select F2]) AND (([Domtable].Level)=[Select Level]) AND (([Domtable].[Split Set])=[Select Split Set]) AND (([Domtable].[Parent PK Selected])=[Select Parent PK]));Received on Sat May 23 1998 - 09:41:21 CDT