Re: executing an SQL statement
Posted by:
Lois Kim
Date: May 08, 2007 11:22AM
Hi Randy,
I thought I would try to post one more time.
Here's my statement. Instead of using INTO OUTFILE, I'm using OPEN file handler per my boss. It still does not line up the columns queried from two tables.
$sth = $dbh->prepare("SELECT RPAD(miha05.Caseid,5,' '),
RPAD(m_fname,25,'*'),
RPAD(m_lname,40,' '),
RPAD(miha05dob.m_dob,10,' '),
RPAD(miha05dob.baby_dob,10,' '),
RPAD(miha05.batch,1,' '),
RPAD(miha05.spanish,1,' '),
RPAD(miha05.outcome,2,' ')
FROM miha2005.miha05dob
LEFT JOIN miha2005.miha05
ON miha05.caseid=miha05dob.caseid
WHERE miha05.batch=5
AND miha05.outcome=5
AND miha05.wictrac=1
AND miha05.caseid=miha05dob.caseid
ORDER BY miha05.caseid
LIMIT 4");
$sth->execute ();
Lois K.