Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Dreamweaver ASP and MSSQL---  multiple query problem

Posted on 2004-09-01
3
Medium Priority
?
411 Views
Last Modified: 2012-06-21
When I run the following query in  the Query Analyzer I get correct values

SELECT dbo.tutee.idratuteeid,dbo.tutee.firstname,dbo.tutee.lastname,dbo.tutee.mi,dbo.tutee.gradelevel,dbo.tutee.room,dbo.tutee.elemteacherid,dbo.elemteacher.elemteacherid,dbo.elemteacher.firstname,dbo.elemteacher.lastname
FROM dbo.tutee, dbo.elemteacher
WHERE dbo.elemteacher.elemteacherid=dbo.tutee.elemteacherid

 AND dbo.tutee.teachercoordid =101


When Dreamweaver's ASP repeated regions behavior codes it like this..

          <td><%=(Recordset1.Fields.Item("idratuteeid").Value)%></td>
          <td><%=(Recordset1.Fields.Item("firstname").Value)%></td>
          <td><%=(Recordset1.Fields.Item("lastname").Value)%></td>
          <td><%=(Recordset1.Fields.Item("mi").Value)%></td>
          <td><%=(Recordset1.Fields.Item("gradelevel").Value)%></td>
          <td><%=(Recordset1.Fields.Item("room").Value)%></td>
          <td><%=(Recordset1.Fields.Item("elemteacherid").Value)%></td>
          <td><%=(Recordset1.Fields.Item("elemteacherid").Value)%></td>
          <td><%=(Recordset1.Fields.Item("firstname").Value)%></td>
          <td><%=(Recordset1.Fields.Item("lastname").Value)%></td>

The firstname and lastname values come from the same table which is BAD!!!
What can I add to the Dreamweaver ASP code  to call from the correct tables.
Since I am a dumb dumb...I tried
          <td><%=(Recordset1.Fields.Item("dbo.elemteacher.lastname").Value)%></td>

and got a an error.

Obviously one of the problems is that the column names in the separate tables are the same...firstname, lastname...
1. Should I have named the differently?
2.  Is there a way for Dreamwever's ASP to differentiate between dbo.elemteacher.lastname and dbo.tutee.lastname

Thanks
0
Comment
Question by:hbojorquezgeek
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
BillAn1 earned 500 total points
ID: 11954903
you need to give the cols distinct aliases in the SQL , then you can refere to them properly in your ASP by their aliases :

SELECT
          dbo.tutee.idratuteeid AS idratuteeid,
      dbo.tutee.firstname AS tutee_fisttname,
      dbo.tutee.lastname AS tutee_lastname,
      dbo.tutee.mi as tutee_mi,
      dbo.tutee.gradelevel as gradelevel,
      dbo.tutee.room as room,
      dbo.tutee.elemteacherid as tutee_elemteacherid,
      dbo.elemteacher.elemteacherid as teacher_elemteacherid,
      dbo.elemteacher.firstname as teacher_firstname,
      dbo.elemteacher.lastname as teacher_lastname
FROM dbo.tutee, dbo.elemteacher
WHERE dbo.elemteacher.elemteacherid=dbo.tutee.elemteacherid
 AND dbo.tutee.teachercoordid =101
0
 

Author Comment

by:hbojorquezgeek
ID: 11955100
First...if I could I would bear your children!!!
Thank you...I am an obvious beginner at SQL and had no idea that I could do that... I've learned so much from this place about triggers and etc...THANKS!
You so rock.
0
 
LVL 17

Expert Comment

by:BillAn1
ID: 11955189
thanks I'm sure ?!
just don't forget to close out on a Question if you have the answer :-)
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In this blog post, we’ll look at how using thread_statistics can cause high memory usage.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

661 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question