Re: [Tutor] Question on a select statement with ODBC

2014-10-23 Thread Peter Otten
Al Bull wrote: > Quick question then... > > Does this do the trick? I may have misunderstood your original question; do you want to delete records from the database or from the Python list? Your code below will do the latter, once you have fixed the bugs. > Currentrecord = 1 > > While curre

Re: [Tutor] Question on a select statement with ODBC

2014-10-23 Thread Al Bull
-Original Message- From: Tutor [mailto:tutor-bounces+a.bull=pubdmgroup@python.org] On Behalf Of Alan Gauld Sent: Wednesday, October 22, 2014 12:13 PM To: tutor@python.org Subject: Re: [Tutor] Question on a select statement with ODBC On 22/10/14 16:06, Al Bull wrote: > I don'

Re: [Tutor] Question on a select statement with ODBC

2014-10-22 Thread Alan Gauld
On 22/10/14 16:06, Al Bull wrote: I don't think I explained the problem properly. I have several hundred thousand records in the ORD table. There are many instances of records with identical ORD_DBASUB values. Where duplicates exist, I only want to keep the most current record. Ah, OK th

Re: [Tutor] Question on a select statement with ODBC

2014-10-22 Thread Al Bull
-Original Message- From: Tutor [mailto:tutor-bounces+a.bull=pubdmgroup@python.org] On Behalf Of Alan Gauld Sent: Tuesday, October 21, 2014 6:42 PM To: tutor@python.org Subject: Re: [Tutor] Question on a select statement with ODBC On 21/10/14 19:57, Al Bull wrote: > have multi

Re: [Tutor] Question on a select statement with ODBC

2014-10-21 Thread Alan Gauld
On 21/10/14 19:57, Al Bull wrote: have multiple records per ord_dbasub. Is there a way I can structure the select statement to retrieve only the most current record (based on ord_date)? Yes, the cursor can be told to only retrieve N records, in your case 1. SELECT ord_dbasub, ord_pub,ord_dat

[Tutor] Question on a select statement with ODBC

2014-10-21 Thread Al Bull
Windows 7.0 Python 3.3.4 I am accessing a database table via ODBC. The table I am accessing can have multiple records per ord_dbasub. Is there a way I can structure the select statement to retrieve only the most current record (based on ord_date)? I used to program in PL/I and assembly in the