Thanks SO MUCH...I got it working now! Whew! This is one for the books! AND...thanks so much to ALL who helped me struggle through this project. Next time I hear Sybase...I may run screaming!
It's Miller Time! ;-) Dian ~ -----Original Message----- From: Ali Dawar Abbas [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 13, 2005 11:43 PM To: [email protected] Subject: RE: [ASP] Help w/Query from hell Hi, The syntax is like Select Table1.Column1,Table1.Column2,Table2.Column1 >From Table1 Inner Join Table2 On (table1.PrimaryKeyColumn = table2.ForeignKeyColumn) In your case gstrSQLQuery = _ "SELECT csdbo.CLIENT.lastname, csdbo.CLIENT.firstname, " _ & "csdbo.CLIENT.m_address1, csdbo.CLIENT.m_address2, csdbo.CLIENT.m_city, " _ & "csdbo.CLIENT.m_state, csdbo.CLIENT.m_postalcode, csdbo.PATIENT.patientid, " _ & "csdbo.PATIENT.name, csdbo.PATIENT.sexid, " _ & "csdbo.PATIENT.color, csdbo.PATIENT.birthdate, csdbo.PATIENT.speciesid, " _ & " csdbo.PATIENT.breedid, csdbo.CLIPHONE.clientid, " _ & " csdbo.CLIPHONE.phone, csdbo.CLIPHONE.extension " _ & " FROM csdbo.CLIENT Inner Join csdbo.PATIENT on (csdbo.PATIENT.patientid=csdbo.OWNER.patientid)" _ & " INNER JOIN csdbo.OWNER ON (csdbo.CLIENT.clientid=csdbo.OWNER.clientid)" _ & " WHERE (((csdbo.PATIENT.patientid)=" & glngPatientRecNum & "));" Note: csdbo.CLIPHONE is missing in the Joining condition so please add it accordingly Hope it should resolve your problem Regards Ali Dawar Abbas -----Original Message----- From: Dian D. Chapman [mailto:[EMAIL PROTECTED] Sent: 14 April 2005 09:27 To: Group - ASP Subject: [ASP] Help w/Query from hell I've been messing with this one for about 2 hrs now to see if I can figure it out...but maybe someone here can see what I'm messing up? In this query...asking for a bunch of specific fields from PATIENT and CLIENT...joining them up through the 3rd OWNER table (patientid/clientid) where the patientid = the current rec...I'm getting an error: "Syntax error near ON" Help! gstrSQLQuery = _ "SELECT csdbo.CLIENT.lastname, csdbo.CLIENT.firstname, " _ & "csdbo.CLIENT.m_address1, csdbo.CLIENT.m_address2, csdbo.CLIENT.m_city, " _ & "csdbo.CLIENT.m_state, csdbo.CLIENT.m_postalcode, csdbo.PATIENT.patientid, " _ & "csdbo.PATIENT.name, csdbo.PATIENT.sexid, " _ & "csdbo.PATIENT.color, csdbo.PATIENT.birthdate, csdbo.PATIENT.speciesid, " _ & "csdbo.PATIENT.breedid, csdbo.CLIPHONE.clientid, " _ & "csdbo.CLIPHONE.phone, csdbo.CLIPHONE.extension " _ & "FROM csdbo.CLIENT, csdbo.PATIENT INNER JOIN (csdbo.OWNER ON " _ & "(csdbo.PATIENT.patientid=csdbo.OWNER.patientid) AND " _ & "(csdbo.CLIENT.clientid=csdbo.OWNER.clientid)) " _ & "WHERE (((csdbo.PATIENT.patientid)=" & glngPatientRecNum & "));" TIA for any help! Dian ~ -- This email scanned and certified clean by AVG! Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 4/12/2005 --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links -- No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 4/12/2005 -- This email scanned and certified clean by AVG! Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.9.7 - Release Date: 4/12/2005 --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/active-server-pages/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
