joins again

Results 1 to 2 of 2

Thread: joins again

  1. #1
    Chris M Guest

    Default joins again

    I&#039;m a beginner. This is a simplified version of my ASP code. What I want is to print out Monday AND Tuesday&#039;s TV program for Bob after objConn.Find "viewer=&#039;Bob&#039;" <BR><BR>If it looks like there are other problems with the way the ASP code is written, it may be because it doesn&#039;t fit in this &#060;textarea&#062; box properly, but let me know, please. <BR><BR>Thanks. <BR><BR>&#060;% <BR>dim objConn, strSQL <BR>set objConn = server.createobject("ADODB.Recordset") <BR>strSQL="SELECT weekdays.viewer, weekdays.monday, weekdays.tuesday, weekdays.wednesday, weekdays.thursday, weekdays.friday, "_ <BR>& "programs.tvid, programs.tvname FROM "_ <BR>& "weekdays INNER JOIN programs ON (weekdays.monday=programs.tvid OR weekdays.tuesday=programs.tvid)" <BR> strSQL, "DSN=tvviewing", adOpenDynamic, adLockPessimistic, adCmdText <BR>objConn.Find "viewer=&#039;Bob&#039;" <BR>Response.Write "Bob watches " & objConn("tvname") &#039;WHAT TO DO HERE?? <BR>objConn.close <BR>set objConn=nothing <BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: joins again

    You are pulling back the whole table from the database and then trying to filter for bob, it would be more efficient to only grab bob&#039;s stuff in the first place.<BR>You can do this buy putting "viewer = bob" into the sql statement where clause.<BR>Then when you open your recordset you move the cursor through it and response.write each row.<BR><BR>I would give you more on this but it is not totally clear when your data model looks like, if you post what your tables look like I could help you more.<BR><BR>Damian

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts