Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

ASP.NET Forum


You are currently viewing our ASP.NET Forum as a guest. Please register to participate.
Login



Reply
"Latest Added" Problem
Old 01-10-2006, 08:19 AM "Latest Added" Problem
Experienced Talker

Posts: 38
Trades: 0
I'm trying to add a Latest Added section to my site for the downloads etc but i cannot seem to get the date right(i'm assuming that's what it it) because it works to a certain point but then it will just show more than 20 results.. it shows all results from say a month of updating? any1 could point me in the right direction that would be great. thanks for reading.

strSQL = "Select LATEST 10 * "
strSQL = strSQL & "From wall "
strSQL = strSQL & "Where date> ()now " - this is where i am stuck
strSQL = strSQL & "ORDER BY date DESC"
phreakyphonez is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-10-2006, 03:22 PM
ExpressoDan's Avatar
Ultra Talker

Posts: 317
Name: This Space for Rent
Location: Georgia
Trades: 0
Try this
strSQL = "Select LATEST 10 * From wall Where date > "&now()&"
ORDER BY date DESC"

Is LATEST a SQL function? If not then use TOP instead. That will only return the top ten results
__________________

Please login or register to view this content. Registration is FREE

"I think therefore I am, I think." <!-- George Carlin
ExpressoDan is offline
Reply With Quote
View Public Profile Visit ExpressoDan's homepage!
 
Old 01-10-2006, 03:50 PM
Experienced Talker

Posts: 38
Trades: 0
Yeh sorry i am not too good at this. I have tried this but it brings pretty much all the results with a date?

strSQL = "Select TOP 10 *"
strSQL = strSQL & "From wall "
strSQL = strSQL & "ORDER by date > now()"
phreakyphonez is offline
Reply With Quote
View Public Profile
 
Old 01-10-2006, 03:54 PM
Experienced Talker

Posts: 38
Trades: 0
Thinking about it, if that was to return the results, would that return the results within the last 24 hours? or a date greater than todays? I basicaly want to return the latest videos i have added within the last 24 hours as i update daily. thanks for your help.
phreakyphonez is offline
Reply With Quote
View Public Profile
 
Old 01-11-2006, 05:20 AM
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
In that case you don't need to use TOP since you don't know how many records there will be. You just need to work out your WHERE clause to pick only records with a date that's in the last 24 hours.
Code:
SELECT *
FROM wall
WHERE Date > @MyDate
ORDER BY Date
@MyDate should be worked out as now() minus 24 hours. (I've used an SQL Pareter bt you can also use string concatination)

p.s. "ORDER by date > now()" is invalid SQL. ORDER BY just specifies which column(s) to sort the data on, so "> now()" is irrelevant. Comparisons should probably go in your WHERE clause.
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Reply     « Reply to "Latest Added" Problem
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.48918 seconds with 12 queries