Hi Tim, Thanks for the emsil. I previously used "effective_date" as well as date. Unfortunately, the code didn't work well. Cheers Tony�
-----Original Message----- From: Tim Harsch [mailto:[EMAIL PROTECTED]] Sent: 21 February 2002 17:34 To: Jeff Urlwin; Ho, Tony; [EMAIL PROTECTED] Subject: RE: DBI SQL Query You should also probably be using placeholders ie "date = ?" For portability reasons I suggest you change the name of the "date" column to something else. It is a reserved word in most databases. I'm guessing your using Sybase or SQL Server. --- Jeff Urlwin <[EMAIL PROTECTED]> wrote: > > > > Hi guys > > I was wondering if you could help me. > > I have the following SQL query on command-line and > I get the > > resulting data > > : > > > > 1> select ITEM_ID,START_DATE, END_DATE from > tableABC where ACCOUNT = 2435 > > and > > SEQ = 16 and DATE = 19971208 > > 2> go > > ITEM_ID START_DATE > END_DATE > > ----------------- -------------------- > ------------------ > > ABC3M 19940111 > 19991213 > > ABCBM 19960912 > 19980420 > > ABCRM 19960912 > 19980420 > > ABCSM 19960912 > 19980420 > > ABCUM 19940111 > 19980420 > > ABCN2 19990930 > 0 > > ABCEM 19960512 > 0 > > ABCEP 19990603 > 0 > > ABCBM 19960912 > 0 > > UNDIR 19940111 > 0 > > > > (10 rows affected) > > > > If I put this query into the prepare statement of > my DBI code as follows : > > > > $supplementary_services_sth = > $dbh->prepare("select > > > ITEM_ID, > > > START_DATE, > > > END_DATE > > from > tableABC > > where > ACCOUNT = $account > > and > SEQ = $seq > > and > DATE = $date"); > > > > $sth->execute > > or die "Unable to execute the SQL > Statement : $DBI::errstr\n"; > > > > $sth->bind_columns(\($item, $start_date, > $end_date)); > > This looks like you are binding different data than > you specify in the query > above... > > > > > while($sth->fetchrow_array) { > > some code.... > > } > > > > After I execute my code, I appear to be obtaining > only those rows that > > END_DATE <> 0 > > Any ideas why the code is not picking ALL rows ? > > > > I would be most grateful. > > Cheers > > Tony > > > Jeff > __________________________________________________ Do You Yahoo!? Yahoo! Sports - Coverage of the 2002 Olympic Games http://sports.yahoo.com
