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 June 29th, 2007, 07:04 PM
superdrog superdrog is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 4 superdrog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 19 m 23 sec
Reputation Power: 0
Help!!!!

I have to try and get my head around this question and ive never seen sql this advanced before.please set me in the right direction.thanks in advance.

Using the meeting table schema below provide a SQL statement to create a view in Microsoft SQL Server that will return only 1 record displaying the contents of the MEETING_NUMBER field. The rules for the view are as follows:
• The START_DATE field which contains the start date of the meeting record must contain a value before the current system date.
• The START_DATE field must be the closest date to the current system date.

ID int (4)
DOC_CLASS varchar (30)
DOC_NUMBER int (4)
REVISION int (4)
START_DATE datetime (8)
FINISH_DATE datetime (8)
MEET_TIME varchar (5)
VENUE varchar (50)
TYPE varchar (50)
MEETING_NUMBER varchar (11)
CUTOFF_PERIOD int (4)
CUTOFF_TIME varchar (5)
AGENDA_STATUS varchar (50)
SUBJECT varchar (50)
SPONSORING_MIN varchar (50)
SUPP_AGENDA_STATUS varchar (50)

Possible answer:
select meeting_number
from meeting
where start_date < getdate()
order by start_date desc

Reply With Quote
  #2  
Old July 1st, 2007, 01:20 PM
superdrog superdrog is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 4 superdrog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 19 m 23 sec
Reputation Power: 0
heres my attempt.No one in here seems to have a clue but u never know what pops into someones head?

CREATE VIEW Meeting_View
AS
SELECT Meeting.MEETING_NUMBER
FROM Meeting m1
WHERE START_DATE < GETDATE()
AND EXISTS
(SELECT MAX(START_DATE)
FROM Meeting m2
WHERE m1.MEETING_NUMBER = m2.MEETING_NUMBER)

Reply With Quote
  #3  
Old July 3rd, 2007, 01:34 AM
superdrog superdrog is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2007
Posts: 4 superdrog User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 4 h 19 m 23 sec
Reputation Power: 0
Got it finished.I hope its right.Sorry I took so long:

CREATE VIEW Meeting_View
AS
SELECT Meeting.MEETING_NUMBER
FROM Meeting m1
WHERE START_DATE < GETDATE()
AND NOT EXISTS
(SELECT MAX(START_DATE)
FROM Meeting m2
WHERE m2.START_DATE > m1.START_DATE AND START_DATE < GETDATE())

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft SQL Server > 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 3 hosted by Hostway
Stay green...Green IT