SunQuest
 
           .NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
Go Back   ASP Free ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now!
  #1  
Old April 11th, 2001, 07:09 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
SQL Statement

<i><b>Originally posted by : Mark Smith</b></i><br />I have a .asp page that I am using to show users data once they log in. The data is coming from an Access 2000 database containing 4 tables:<br /><br />Details (Primary key = user)<br />Notes (Primary key = noteid)<br />Vehicle (Primary key = regno)<br />History (Primary key = bookingid)<br /><br />The relationships between these are:<br /><br />Details to Vehicle = Field named user<br />Details to Notes = Field named user<br />Vehicle to History = Field named regno<br /><br />So far I can view data from the Details table and the Notes table when a user logs in by using this statement:<br /><br />sqltemp="select * from details left outer join notes " & _ <br /> " on details.USER = notes.USER where details.USER = '" <br />sqltemp=sqltemp & myname & "'"<br /><br />(i.e Notes field is sometimes blank)<br /><br />I am having trouble modifying this statement that would allow me to view details from Vehicle and the History table for the user that logged in. Can anyone help with the SQL statement as I really am stuck on this one!<br /><br />Thanks<br />Mark<br /><br />

Reply With Quote
  #2  
Old April 12th, 2001, 05:22 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,578 Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level)Steve Schofield User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 22
<i><b>Originally posted by : Mage (mage@baltnet.ru)</b></i><br />Hi, Mark!<br /><br />Try to make it simple! As far as I understand you need all the data related to one user from all your 4 tables. If so try this:<br /><br />SELECT * FROM details,notes,vihicle,history WHERE vihicle.user='" & myname & "' AND vihicle.regno=history.regno AND details.user='" & myname & "' AND notes.user='" & myname & "'"<br /><br />And LEFT JOIN doesn't need to be OUTER - it's the same: LEFT JOIN == LEFT OUTER JOIN<br /><br /><br />Hope that helps (if it doesn't write again :-)<br /><br />Mage<br /><br /><br /><br />------------<br />Mark Smith at 4/11/2001 5:09:24 PM<br /><br />I have a .asp page that I am using to show users data once they log in. The data is coming from an Access 2000 database containing 4 tables:<br /><br />Details (Primary key = user)<br />Notes (Primary key = noteid)<br />Vehicle (Primary key = regno)<br />History (Primary key = bookingid)<br /><br />The relationships between these are:<br /><br />Details to Vehicle = Field named user<br />Details to Notes = Field named user<br />Vehicle to History = Field named regno<br /><br />So far I can view data from the Details table and the Notes table when a user logs in by using this statement:<br /><br />sqltemp="select * from details left outer join notes " & _ <br /> " on details.USER = notes.USER where details.USER = '" <br />sqltemp=sqltemp & myname & "'"<br /><br />(i.e Notes field is sometimes blank)<br /><br />I am having trouble modifying this statement that would allow me to view details from Vehicle and the History table for the user that logged in. Can anyone help with the SQL statement as I really am stuck on this one!<br /><br />Thanks<br />Mark<br /><br />

Reply With Quote
Reply

Viewing: ASP Free ForumsProgramming.NET Development > SQL Statement


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway