Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft SQL Server

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old September 17th, 2007, 10:52 AM
Billybong Billybong is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Sep 2007
Posts: 2 Billybong User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 6 sec
Reputation Power: 0
Question Multiple Table Select

Hi,

I'm really stuck with an SQL statement that i wish to build.

What i have are a number of tables :

Table : Questions
---------------

QuestionID | QuestionName | QuestionText
---------------------------------------------------------------------------------------------------
1 | Question 1 | This is my first question
2 | Question 2 | This is my second question


Table : Options
-----------------------

OptionID | QuestionID | OptionText
---------------------------------------------------------------------------------------------------
33 | 1 | This option is for Question 1
34 | 1 | This is my second option Question 1
35 | 2 | This option is for Question 2
36 | 2 | This is my second option Question 2


Table: Answers
----------------------

AnswerID | QuestionID | OptionID | SessionID (Computer Session ID)
-------------------------------------------------------------------------------------------------------
1 | 1 | 33 | 4352652652
2 | 2 | 35 | 4352652652
3 | 1 | 36 | 3242345454
4 | 2 | 36 | 3242345454


Basically, i want to create an output in asp (i know asp fairly well) but i can't figure out how to join these

I need to select from the Table Answers, where sessionID = my inputted session ID
The display all answers of that session ID ( i know how to do this)
But rather than display the answers as : 33, 35, 36 - i want to reference the Option Text from the Options Table - basically displaying something like

All Answers for Session ID: 4352652652

QuestionID | QuestionName | Answer/Option
-----------------------------------------------------------------------------------------------------------
1 | Question 1 | This option is for Question 1
2 | Question 2 | This is my second option Question 2



Hope i haven't confuses too many people.
Can anyone advise how i can go about this ?

Many thanks,

Billybong

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > Multiple Table Select


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