SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL 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:
  #1  
Old October 5th, 2000, 09:28 PM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 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
Help with SQL Query

<i><b>Originally posted by : Patrick (spamboy@dugans.com)</b></i><br />I have a database with three tables, Faculty, Degrees and Images. Here's my SQL query right now:<br /><br />SELECT Faculty.*,Degrees.Degree,Images.ImgName FROM Faculty,Degrees,Images<br />WHERE Faculty.FacID=7 AND Degrees.FacID=7 AND Images.FacID = 7<br /><br />This successfully pulls all the info for this faculty member with id 7, and all of the member's degrees and images from the Degrees and Images tables respectively. Here's the catch. There might not be any degrees or images with an id of 7. How can I write a SQL statement that will pull all a faculty member's data, and will give images and degrees if they exist?

Reply With Quote
  #2  
Old November 7th, 2000, 03:04 AM
Steve Schofield Steve Schofield is offline
Contributing User
ASP Free God 20th Plane (14500 - 14999 posts)
 
Join Date: Dec 2002
Posts: 14,575 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 : iyyappan n iyer (iyyappan_n_i@hotmail.com)</b></i><br /><br /><br /><br />select * from faculty,degrees,images where (faculty.facid=7 ) or (faculty.facid=7 and degrees.facid = 7 and images.facid=7)<br /><br /><br />

Reply With Quote
  #3  
Old October 9th, 2003, 12:37 PM
m_lazor m_lazor is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Luxembourg
Posts: 156 m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level)m_lazor User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
SELECT Faculty.*,Degrees.Degree,Images.ImgName FROM Faculty,Degrees,Images
WHERE Faculty.FacID= Degrees.FacID AND Images.FacID = Faculty.FacID AND Faculty.FacID = 7

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Help with SQL Query


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 1 hosted by Hostway
Stay green...Green IT