473,320 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Order by two sql server fields datalength and date

229 100+
Hi, I order with datalength and that's fine.

Expand|Select|Wrap|Line Numbers
  1. order by datalength(workingmethods) desc,
I was wondering if there is a way of combining with date members registered. The result being those newest members (JOINDATE) with the most data (WORKINGMETHODS) being returned first in the results..


This does not work
Expand|Select|Wrap|Line Numbers
  1. order by datalength(workingmethods) desc, JoinDate desc
Any pointers would be appreciated.
Thanks
Richard
Feb 1 '14 #1

✓ answered by zmbd

If all you are worried about is sorting then, provided the rest of your SQL is properly formed then:
Expand|Select|Wrap|Line Numbers
  1. ORDER BY datalength(workingmethods) DESC, JOINDATE DESC;
Should sort by the datalength() then the JOINDATE
What I didnt' see was the closing semicolon ";"

1) Please clarify if you are only attempting to sort on two field within the same table, or what it is that you are actually attempting to do

2) Please post the entire SQL. All too often the SQL string is malformed. Spacing, square brackets and puncutation, and order of clauses are all importaint and can result in the best case what you want to see, simply return nothing, or can delete entire databases in the case of an action query.

2 1551
Luuk
1,047 Expert 1GB
"This does not work".....
hmmm, maybe you do need:
Expand|Select|Wrap|Line Numbers
  1. order by JoinDate desc, datalength(workingmethods) desc, 
But it's a bit unclear when reading your post.... ;)
Feb 1 '14 #2
zmbd
5,501 Expert Mod 4TB
If all you are worried about is sorting then, provided the rest of your SQL is properly formed then:
Expand|Select|Wrap|Line Numbers
  1. ORDER BY datalength(workingmethods) DESC, JOINDATE DESC;
Should sort by the datalength() then the JOINDATE
What I didnt' see was the closing semicolon ";"

1) Please clarify if you are only attempting to sort on two field within the same table, or what it is that you are actually attempting to do

2) Please post the entire SQL. All too often the SQL string is malformed. Spacing, square brackets and puncutation, and order of clauses are all importaint and can result in the best case what you want to see, simply return nothing, or can delete entire databases in the case of an action query.
Feb 1 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Tim Chmielewski | last post by:
For an auto-generated form I have the following order of fields: savevalues userid productcode PrintColour1_1 Colour1_1 Quantity_1 " " " " " " " ...
0
by: Maciej Zoltowski | last post by:
Hi, I've got a following problem with the order of fields in extended element: let's assume, that I have a complex type with a few fields, that I want to extend with additional field. In...
3
by: D. Stimits | last post by:
I'm not looking for an exact answer here, but instead something more "rule of thumb". If I have a table with many fields, and I retrieving small groups of fields during a SELECT, whereby the groups...
1
by: Ralph | last post by:
Hello I am using the report wizard in A2K to print 4 fields with my table as my data source. I would like the order of the fields to stay the same a; b; c; and d. When I make "print 1" and sort on...
4
by: Joe User | last post by:
Hi all....I have a feeling this is going to be one of those twisted query questions, but here it goes anyways.... I want to generate a report that shows the chronology of events (represented by...
1
by: Todd D. Levy | last post by:
Normally, I have a date field in the query that a report is based on that requests the user to select a start date and an end date. I now have a situation where there are 2 date fields that the...
2
by: Monica Roman | last post by:
Hello all, I have an Access database linked to SQL Server tables and Views. When I upsized the Access tables all the yes/no fields remained the same, i.e., I see a check mark or not. When I...
1
by: Phil Galey | last post by:
I'm using XMLSerializer in VB.NET to serialize class-based objects to XML. It's serializing fine, except that I don't seem to have control over the order in which the various fields (properties) of...
23
clumsyhead
by: clumsyhead | last post by:
Hello guys, I've gotten a question. Hope someone can help. I'm using Access 97 on XP. I have a table of 3 fields: EmployeeID, ModuleID and TrainedDate. I created a query...
1
by: wvahimana | last post by:
i'm creating a timetable database and in my date table has these fields date code and date details and i don't know what type of data to be stores under date code fields so can you help me. Wanda
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.