Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

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 Codewalkers Forums Sponsor:
  #1  
Old February 12th, 2004, 09:12 AM
Andrew's Avatar
Andrew Andrew is offline
Moderator
Click here for more information
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,942 Andrew User rank is Private First Class (20 - 50 Reputation Level)Andrew User rank is Private First Class (20 - 50 Reputation Level)  Folding Points: 2429 Folding Title: Novice Folder
Time spent in forums: 4 Days 4 h 4 m 34 sec
Reputation Power: 3
Orkut
Joins

hi i have a table in my database which is for news for a site i am making a CMS for and they want date and time displaying seperatly eg:

On: DD-MM-YYYY At: 00-00-00

so i have 2 fields in the table (date and time) date is set to date and time is set to time and i want to order news by date and time (when displayed)

At the moment im ordering news by ID not by time so to order by time i need to join date with time i know how to perform joins but would LEFT OUTER JOIN be the best join to use? If not does anyone know another join that would be useful?

Reply With Quote
  #2  
Old February 12th, 2004, 10:15 AM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: Joins

Well, what is the common field you are going to join? Are you joining by the ID? Then a LEFT JOIN should do the trick.

Reply With Quote
  #3  
Old February 12th, 2004, 12:51 PM
Blindeddie Blindeddie is offline
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: NJ - USA
Posts: 2,152 Blindeddie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 4
RE: Joins

If the date and time fields are in the same table, there is no need to do a join, you just need to specify both date and time in the order by clause like so.

SELECT * FROM NEWS ORDER BY date, time

That will output the records in date/time order, give it a try...

Reply With Quote
  #4  
Old February 12th, 2004, 12:58 PM
nawlej nawlej is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Dallas, Tx. USA
Posts: 2,008 nawlej User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 11 h 7 m 51 sec
Reputation Power: 4
RE: Joins

oh, silly me, I thought he said he had date and time in two separate tables....hmmm.

Reply With Quote
  #5  
Old February 12th, 2004, 03:17 PM
Andrew's Avatar
Andrew Andrew is offline
Moderator
Click here for more information
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,942 Andrew User rank is Private First Class (20 - 50 Reputation Level)Andrew User rank is Private First Class (20 - 50 Reputation Level)  Folding Points: 2429 Folding Title: Novice Folder
Time spent in forums: 4 Days 4 h 4 m 34 sec
Reputation Power: 3
Orkut
RE: Joins

ok thanks

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Joins


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