Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
jennifer_ann
Starting Member
8 Posts |
Posted - 2006-04-10 : 17:21:08
|
| Ok this is what I have $query = $query = "SELECT date, file name FROM comment WHERE file name ='', AND CorS='C', AND Approved='Y', ORDER BY file name DESC";But what I want is to return all results based on the file name from the most recent to the oldest. Can anyone help???? |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
Posted - 2006-04-10 : 17:23:30
|
| ORDER BY [date] DESCTara Kizeraka tduggan |
 |
|
|
jennifer_ann
Starting Member
8 Posts |
Posted - 2006-04-10 : 19:22:13
|
| I should have clarified better. My file name is named by the date people left it. So how do I order by that? |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2006-04-10 : 19:54:40
|
What is the format of the filename ? is it in a certain fixed format ? KH |
 |
|
|
jennifer_ann
Starting Member
8 Posts |
Posted - 2006-04-10 : 20:13:41
|
| What everyone has said has helped me out, and I've made progress on my queries, however they still are not what I need and I'm not sure how to fix it. So here goes. I have a table that has UserID, date, name, yrleft, cityorigin, countryorigin, yrarrival, cityarrival, starrival, email, address, city, state, zip, aorv, filename, and approvedMandatory information includes the date, yrleft, cityorigin, countryorigin, yrarrival, cityarrival, starrival, and aorv. The filename is named with a timestamp as to when they left their recording or comment.I need to run a query by dates from (1850-1950) so whatever date they put in, as long as it is within that time period, that it will return the results. I want to display the earliest date first. I want the results to return all the mandatory information. And approved must = YThis is what I've gotten so farPHP Code:$query = $query = "SELECT Userid, date, yrleft, cityorigin, countryorigin, yrarrival, cityarrival, statearrival, filename FROM Story WHERE approved = 'Y' AND ORDER by date ASC Could someone tell me why this still isn't working? I need Searches ==== sort based on search type: Dates - descendingreturns....all required fields except name...include Id and filename |
 |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2006-04-10 : 20:26:38
|
$query = "SELECT Userid, date, yrleft, cityorigin, countryorigin, yrarrival, cityarrival, statearrival, filename FROM Story WHERE approved = 'Y' AND ORDER by date ASC -- ASC is Default-- If u want Descending order u have to provide DESC and not ASC or not just leave it -- From ur earlier post date should be --> [file name]-- Ur first query and last query differs -- Ur End of String Quotation is missingSo ur probable query should be something like$query = "SELECT Userid, date, yrleft, cityorigin, countryorigin, yrarrival, cityarrival, statearrival, filename FROM Story WHERE approved = 'Y' ORDER by [file name] DESC" Srinika |
 |
|
|
jennifer_ann
Starting Member
8 Posts |
Posted - 2006-04-10 : 22:08:49
|
| Thank you very much! you all have been such a big help |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|
|
|