AnsweredAssumed Answered

SQL in python

Question asked by fallingdog on Apr 14, 2015
Latest reply on Apr 15, 2015 by bixb0012

The situation:

 

I have a table that is in a oracle database that I need to query and then spatialize. I need to select the most recant updated record for each group. I have a last update column to base the max date on. Then I have a name and a sand type columns that should make up the groups. So after some looking I think this is the sql that I need:

 

SELECT NAME, SAND, MAX(LAST_UPDATE) AS "DATE" from MY_TABLE

GROUP BY NAME, SAND

 

I have run it in Toad and it produced the desired result.

 

After the query I will need to do a join to a table that has the lat and long data and then make a xy events layer and then export the thing to a feature class in our SDE.

 

The question:

 

What it the best way to do this query in python in such a way that I can pass the output to arcpy for the join etc.

 

Thanks for the help,

 

Forest

Outcomes