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:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old April 22nd, 2003, 07:00 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
just a quickie...

Can you run a query on a table in the database, find those results, and then run another query just on those previous results?
If so, how would you go about doing it?

See, I've got a tour dates page for my band, which queries the table to split the dates into two groups, Upcoming dates and Past dates. I now want to query the upcoming dates so that only the very next gig appears, without the others.

See, the way I split the dates into Upcoming and Past was to run two queries, and place the results in different tables. Eg.

Upcoming
Find todays date, search the table and find dates larger than todays date, display those results.

Past
search the table and find dates smaller than todays date, display those results.


So in the Upcoming query, would I be correct in saying that once its found those results, I should then run another query on those results to find the date with the smallest number?
How would I do that? Any idea?

As you can guess, I'm relatively inexperienced at PHP.

Reply With Quote
  #2  
Old April 22nd, 2003, 07:45 AM
scaRFhogg scaRFhogg is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Bochum, NRW, Germany, EU
Posts: 117 scaRFhogg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to scaRFhogg
RE: just a quickie...

if you only want to show your very next gig you can run a query like:
SELECT * FROM gigs WHERE date > NOW() ORDER BY date DESC LIMIT 1

in this query i assume you store the date of the gigs in a field 'date'.

Reply With Quote
  #3  
Old April 22nd, 2003, 08:07 AM
Anonymous Anonymous is offline
Registered User
Codewalkers God 35th Plane (22000 - 22499 posts)
 
Join Date: Apr 2007
Posts: 22,309 Anonymous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 24
RE: just a quickie...

AHA! Thanks a million - I should have remembered about limits... now I feel stupid!

Thanks again.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > just a quickie...


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 4 hosted by Hostway