Microsoft SQL Server
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft SQL Server

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 August 2nd, 2005, 11:30 AM
firdouseqasim firdouseqasim is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 71 firdouseqasim User rank is Corporal (100 - 500 Reputation Level)firdouseqasim User rank is Corporal (100 - 500 Reputation Level)firdouseqasim User rank is Corporal (100 - 500 Reputation Level)firdouseqasim User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 16 h 6 m 11 sec
Reputation Power: 6
SQL Query Help

I have a question that I need some help on. I have 2 tables

------------------------
scorm
------------------------
scorm_id user_id
course_content_id
content_id

-----------------------
course_content
-----------------------
course_content_id
content_id

Now I want to identify the most recently created record for each user_id/course_content_id pair in the scorm table, and for that record set the content_id = course_content.content_id Where course_content.course_content_id = scorm.course_content_id. And for all the other records with the same user_id/course_content_id, set the content_id = 0. Please let me know if this is possible in SQL. Thank you.

Reply With Quote
  #2  
Old August 2nd, 2005, 12:43 PM
firdouseqasim firdouseqasim is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 71 firdouseqasim User rank is Corporal (100 - 500 Reputation Level)firdouseqasim User rank is Corporal (100 - 500 Reputation Level)firdouseqasim User rank is Corporal (100 - 500 Reputation Level)firdouseqasim User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 16 h 6 m 11 sec
Reputation Power: 6
I figured it out.

Quote:
Originally Posted by firdouseqasim
I have a question that I need some help on. I have 2 tables

------------------------
scorm
------------------------
scorm_id user_id
course_content_id
content_id

-----------------------
course_content
-----------------------
course_content_id
content_id

Now I want to identify the most recently created record for each user_id/course_content_id pair in the scorm table, and for that record set the content_id = course_content.content_id Where course_content.course_content_id = scorm.course_content_id. And for all the other records with the same user_id/course_content_id, set the content_id = 0. Please let me know if this is possible in SQL. Thank you.

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft SQL Server > SQL Query Help


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