another one

Results 1 to 2 of 2

Thread: another one

  1. #1
    Join Date
    Dec 1969

    Default another one

    I am looping through my database finding all the distinct categories that a company could fall under, then I have nested within that a loop which prints out the company names which fall under the industry. The problem is when a company falls under more than one category because then it prints out the category as different than the preceeding categories though it is the same it is just more than one. How would I list the company under both categories?<BR><BR>My code:<BR><BR>&#060;%<BR><BR> Set DBConn = Server.CreateObject("ADODB.Connection")<BR> DBConn.Open "mainerec"<BR><BR> SQL = "SELECT DISTINCT SubCat FROM businesses"<BR> Set QTable = DBConn.Execute(SQL) <BR> Do while not QTable.EOF<BR> <BR> if QTable("SubCat") &#060;&#062; "" then Response.Write "&#060;b&#062;" & QTable("SubCat") & "&#060;/b&#062;<BR>"<BR> <BR> SQL = "SELECT * FROM businesses WHERE SubCat=&#039" & QTable("SubCat") & "&#039"<BR> Set QTable1 = DBConn.Execute(SQL)<BR> Do While Not QTable1.EOF<BR> <BR> Response.Write QTable1("Company") & " this is the company <BR>"<BR> <BR> QTable1.MoveNext<BR> Loop<BR> <BR> QTable.MoveNext<BR> Loop<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default See "need DB redesign?"

    which answers the repost of this message

Posting Permissions

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