Sorting The Data In Ascending Order .
Aug 16, 2002
Hi ,
Hopw can i sort the data in the ascending order so that i can see the date of my log files imported at the top of my table .
Right now my log files get imported and appended in the tables but they get appended in the descending order at the bottom of the last data .
Is there any way to sort the data so that i can see it in the reverse way when i open my tables ?
Many Thanks .
Anita.
View 1 Replies
ADVERTISEMENT
Dec 30, 2005
Hi, I've created a website usiing asp.net and all the data are stored in sql front. All the item are sorted in ascending order except one record. The correct order should be MP61, MP100, MP200, but this record is retrieved as MP100, MP200, MP61. If the coding is wrong, all the order displayed is not in ascending order. We have hundreds of items, but why it happens to this particular record? Can anyone help? Thanks in advance
View 3 Replies
View Related
Nov 27, 2007
Hi
I have Constructed a table
Table Name : MasterEntry
Column Name:
MasterEntryNumber
ServiceName
ServiceDepartment
EmployeeName
MasterEntryNumber is GenerationNumber where ever any entry is happen in table
if put a queries [select * From masterentry Order by MasterentryNumber] is give output in ascending order
e.g MasterEntryNumber has
1
2
3 it give correct ordering
but if i exceed more 10 if i put same queries
Output of queries is
1
10
11
2
3 this is the out of the queries if it exceed more 10 rows
i want queries should be look like this
1
2
3
...... 10
did any have experience on this issue please let me know where i can fix
kinds regards
View 8 Replies
View Related
Jan 8, 2008
Hi
I have a table with column name starts from col1 to col20. IS their anyway to insert the data and sort the table by col1 and col2 and SAVE IT.
View 3 Replies
View Related
Sep 24, 2012
In SQL sERVER 2008, I have two fields - Depatment and Employees. I need to sort the result set by employee number ascending order, with following exception
1)when department number = 50 - the preferred order is Employee # - 573 followed by 551-572 (employee # belong to Dept 50 = 551-573)
2)When Department number = 20 – the preferred sort order is Employee # 213-220, followed by Employee # 201-213 (employee # belong to Dept 20 = 201-220)
How shall I achieve this?
View 4 Replies
View Related
Jul 5, 2007
I noticed the StockDate is not sorted in proper order, like ascending order...
Code:
select top 1000 CONVERT(char, StockDate, 101) AS StockDate, timestamp from tblpurchaseraw where accountid = '119' order by stockdate desc
I noticed that StockDate is a datetime datatype so why does the month get ordered 1st, then day get ordered 2nd and year get ordered 3rd...
The sample data is MM/DD/YYYY...
So, how do I get it ordered propery by Year, Month then Day??
View 2 Replies
View Related
Apr 19, 2006
How to sort table in sql2000 with ipaddress(format x.x.x.x) as column with nvarchar datatype in ascending order
without using stored procedure
Ex:
Table: netComputers(3 rows)
Column Name: ipAddress (string data type)
ipAddress
0.0.18.1
0.1.1.2
0.0.0.1
Sql query : if I use the query
Select ipAddress from netComputers order by cast( replace(ipaddress,'.','') as numeric(12)) asc
Gives result as :
ipAddress
0.0.0.1
0.1.1.2
0.0.18.1
Where as expected result should be:
ipAddress
0.0.0.1
0.0.18.1
0.1.1.2
View 18 Replies
View Related
Jan 18, 2005
I have a problem with an Order By sort on a SubmissionDate column in my SQLSERVER DB.
I am inputing a timestamp in this format into the column above: 1/18/2005 11:03:19 AM
Problem is, once I sort this column in DESC order to return the results to a datalist dates with a time like this:
1/18/2005 1:03:19 AM
get placed out of place (lower on the return in DESC/higher on the return in ASC). I am assuming this is happening because it reads 1 as coming before 11 instead of after like it is with time. If this was in 24 hour format this wouldn't be a problem I guess because 1PM would be 13, so that is after 11.
Anyone know what I can do to get this sorted correctly?
View 3 Replies
View Related
Mar 1, 2004
Hi,
I have a situation where I need to sort the output of a cursor. But since the sort criteria are rather complex, I am NOT able to use the Order By clause directly with the cursor definition statement.
Hence, I need to have a solution where I will use a dummy (calculated) field within the CURSOR and I want the output of this cursor sorted by the dummy field that I calculated within the cursor itself.
Please let me know the different possibilities in this scenario.
Thank you in advance
Raj
View 3 Replies
View Related
May 21, 2014
I am trying to sort this simplied table:
ID - Time
1 2000-2001
2 2002-
3 2001-2003
4 1999
5 2005-2006
I want this as a result:
1999
2000-2001
2001-2003
2005-2006
2002-
Because the "-" means "continues", it the thing is still activated, so if it makes it easier, i could put the today's year afterwards during the query, if it ends with a - ...
Now, simply doing a
SELECT * FROM [table] ORDER BY TIME;
Sorts it "perfectly", apart from the "2002-" is just placed before 2005 and after 2001.
So, of course, it fails on all entries with a leading "-" ...
Right when I clicked "submit", of course, I can simply replace all entries with a time ending with "-", with the todays Year, so at least they will get at the end of the query...
Well, have to do a union, first sorting all without the "-", then sorting all with the "-", and that should be it...
View 5 Replies
View Related
Aug 14, 2007
Hi,
I have a matrix report...the column results
are as follows
Con Std , Con Access, SF Std, SF Acc, Broadband, Pay TV
how would i make the columns appear in the above order when displaying as it is default alphetically sorted...I have tried putting numbers at the front which work till I get to the number 10 which alphetically sorted is next to 1 not 9?
is there a better way off sorting matrix column which have no specific criteria to sort from?
thanks
View 6 Replies
View Related
Mar 15, 2008
I am using sql statement like SELECT CREATEDBY,FIRSTNAME,BUSINESS,NOTES,NOTESDATE FROM BUSINESS ORDER BY NOTESDATE DESC, CREATEDBY ASC
But NotesDate is sorting descending order, but only sorting based on the date and month not on year
Please help me
View 4 Replies
View Related
Jan 27, 2015
I am having problem with the unpivot function of sql 2012, i unpivot my column then i get the result that i wanted but the error that i was encountering was the unpivot is automatically sort the column in alphabetically order which is not I desire,
Here is my code
@syear nvarchar(50)
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
[Code] ....
View 1 Replies
View Related
May 19, 2015
I never paid much attention to this before but I noticed this today in a new table I was creating.
For tables defined in the tabular model the table properties have something like SELECT Blah FROM TableName ORDER BY Blah Then in the tabular model the table's data is in the same order it was ordered by in the data source for the table.
I have a date table I setup and I noticed it is NOT respecting the sort order.
I have it sorted by DateID which sorts with the oldest date first and newest date as last row.However, the table that is imported and stored in the data model is not in that order.
I can of course manually sort the rows in BIDS/DataTools, but I find this discrepancy odd.
Would this have negative impacts on the EARLIER function for example if the data rows are not in the order specified?
View 8 Replies
View Related
Feb 11, 2007
I have a report where I am giving the users a parameter so that they can select which field they would like to sort on.The report is also grouping by that field. I have a gruping section, where i have added code to group on the field I want based on this parameter, however I also would like to changing the sorting order but I checked around and I did not find any info.
So here is my example. I am showing sales order info.The user can sort and group by SalesPerson or Customer. Right now, I have code on my dataset to sort by SalesPerson Code and Order No.So far the grouping workds, however the sorting does not.
Any suggestions would help.
Thanks
View 1 Replies
View Related
Jul 10, 2015
SSRS 2012 - VS2010...The report compares two years with a sort order on a value that has been engineered based on text switched to int. When sorting A-Z this is the result in the horizontal axis is: 5th, K, 1st, 2nd, 3rd, 4th, 5th..When sorting Z-A the result in the horizontal axis is:5th, 4th, 3rd, 2nd, 1st, PreK..Z-A is correct but A-Z sorting shows 5th as the start and end. The magnitude of the PreK location is correct but the label is wrong on the A-Z sort order. The sorting is implemented using the Category Group sorting option.
View 6 Replies
View Related
Jul 23, 2005
Below is the statement i am working with and i am trying to figure outhow to have the count in ascending order...is this possible? Right nowit groups by FP in alphabetical order but i dont want that i want thewhatever the FP1 count is to be ascending but i am not sure how to goabout doing this...so any help or ideas?SELECT FP1 AS FP, COUNT(FP1) AS Expr1FROM dbo.FP1WHERE (FP1 IS NOT NULL) AND (LTRIM(RTRIM(FP1)) <> '')GROUP BY FP1
View 3 Replies
View Related
May 20, 2008
Hi,
have uncovered a curious problem with sort ascending in tables.
In a table I'm grouping on CONTRACT_ID field. The grouping works fine but the sort acending on CONTRACT_ID doesn't.
Here are the actual contract id's I have to sort:
0202018B
0202019C
0202020G
0202021H
0202022J
0202023K
0202800B
The above list is how the Crystal Report I'm converting does this sort - i.e. the normal, common sense, intuitive answer.
Here's how SSRS does the sort:
0202022J
0202021H
0202019C
0202800B
0202018B
0202023K
0202020G
i.e. a completely non-intuitive, non common-sense answer!
I can probably solve this by stripping the last character and converting to int via an expression, but why does one get a completely non-sensical answer with the standard values? What is the logic by which Microsoft have implemented sorting. It seems very odd to me. Can anyone shed any light on this?
thanking you in advance,
cheers,
rob
View 3 Replies
View Related
Apr 17, 2008
Hi,
I have a column containing data
3 KB
16 KB
2 KB
4 KB
43 KB
How to sort this column and display results like:
43
16
4
3
2
Thanks.
View 7 Replies
View Related
Jul 20, 2005
ok..here goes..I have a name field in my table called "bname"all of the data in this field has full names in it, spaces areseparated by a "+"ie. "john+doe"i have two other fields that are currently NULL. "First_name" and"Last_name"now my question is obvious.I need to populate "First_name" with all of the data in "bname" to theleft of the "+"and likewise to the Right of the "+" in "Last_name"i sort of know how i would do this in ASP... but im trying to makethis a DTS package... so i was wondering if this could be done in SQLThanks for any help! :DMario C.
View 4 Replies
View Related
Sep 12, 2001
Hello all,
The problem goes like this. I am trying to upsize all my data to a
SQL server and get it out of the old Access 97 database. One of our tables
involves testing reports which tell if an object has passed or failed and
its main key is it's ID autonum. When I look at the table in Access, I see
that the first record in the table has a date of 1/01/97 with an id of 1 and continues through today. When I bring those records into SQL 7, the first record contains a date of 9/01/99 and continues out of order down the table. I need the data in the SQL server to begin with the 1997 record like it is in Access and not with the 1999 record. I cannot have the records appearing in the table as 20, 3, 4, 5, 1, 2 but I need it as 1, 2, 3, 4, 5, 6, because
the id must be in sync correctly. How can I sort the data in SQL 7 ?
View 1 Replies
View Related
Feb 21, 2008
Ok, it is a given that sorting operations are sometimes expensive in SQL Server using the ORDER BY clause because the relational model is not really well suited to sort data blah blah blah.
So the canned DBA response is "this is a presentation issue, handle it in the presentation layer".
OK, great. Problem solved. So I am digging around in the ADO.Net object model trying to give a junior developer some guidance and i am trying to figure out what is the best way in ADO.Net to order what we used to call a recordset where the sorting is not done at the SQL Server, but in IIS.
I imagine there is some overhead in this operation as well. Is it really going to save me some overall performance or am I just shifting the burden and I will not likely see any appreciable difference?
View 8 Replies
View Related
Apr 19, 2004
Hi there,
I got one prob and i need help to solve it.
I got this one field in a table which contain a lot of datas and i need to sort it out into as many different data as a field for each.
Example:
ASP_Tin No
----------------
ss24fg
ss98jk
tp98ij
yh88ij
yh67tr
tp34ed
fg98bv
fg56sl
..........
and i need to sort it out into like this
ss tp yh fg
------------- ------------- ---------------- ---------------
ss24fg tp98ij yh88ij fg98bv
ss98jk tp34ed yh67tr fg56sl
i need to do it in sql statement which is in stored procedure
hope somebody can help me
Thanx
View 2 Replies
View Related
Sep 21, 2006
Dear all,
I have a field [Month] in my table AA.having Data like ( January,February,March,April etc.)
I need to sort them by starting of month
lets say as
January
February
March
How i can i do this
Have no index and can't define a index on this field
Thanks for ur time and Help
Regards
Mohd Sufian
View 12 Replies
View Related
Apr 16, 2008
Currently I have a small page that includes a drop down list with about 120 possible choices to chose from.
The list works fine, however, the choices are not sorted ascending/alphabetical order. So it is very slow searching for
the selection you want.
See the link.
http://visualboxscore.com/boxscores/cfb_box_scores.aspx
Does anyone have any easy solution for this problem?
Below is the code I am using.
<%@ Page Language="VB" %>
<html>
<head id="Head1" runat="server">
<title>Visualboxscore.com - College Football Box score Query page</title>
</head>
<body>
<form id="form1" runat="server">
<b>Select Team:</b>
<asp:DropDownList ID="DropDownList1" DataSourceID="SqlDataSource2" AutoPostBack="true"
DataTextField="offense" runat="server" />
<asp:SqlDataSource ID="SqlDataSource2" runat="server" SelectCommand="SELECT DISTINCT [offense] FROM [cfb_boxscores]"
ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>" />
<br />
<br />
<table>
<tr>
<td valign="top">
<asp:GridView ID="GridView1" AllowSorting="True" AllowPaging="false" runat="server"
DataSourceID="SqlDataSource1" DataKeyNames="date"
AutoGenerateColumns="false" Width="427px">
<Columns>
<asp:BoundField HeaderText="Date" DataField="date" DataFormatString="{0:MM/dd/yy}" ItemStyle-HorizontalAlign="Center" SortExpression="date" />
<asp:BoundField HeaderText="Team" DataField="offense" ItemStyle-HorizontalAlign="Center" SortExpression="offense" />
<asp:BoundField HeaderText="Rush No." DataField="rush_no" ItemStyle-HorizontalAlign="Center" SortExpression="rush_no" />
<asp:BoundField HeaderText="Rush Net" DataField="rush_net" ItemStyle-HorizontalAlign="Center" SortExpression="rush_net" />
<asp:BoundField HeaderText="YPC" DataField="yards_per_carry" ItemStyle-HorizontalAlign="Center" SortExpression="yards_per_carry" />
<asp:BoundField HeaderText="Pass Att." DataField="pass_att" ItemStyle-HorizontalAlign="Center" SortExpression="pass_att" />
<asp:BoundField HeaderText="Pass Yards" DataField="pass_yards" ItemStyle-HorizontalAlign="Center" SortExpression="pass_yards" />
<asp:BoundField HeaderText="YPA" DataField="yards_per_att" ItemStyle-HorizontalAlign="Center" SortExpression="yards_per_att" />
<asp:BoundField HeaderText="No. Plays" DataField="no_plays" ItemStyle-HorizontalAlign="Center" SortExpression="no_plays" />
<asp:BoundField HeaderText="Total Yards" DataField="total_yards" ItemStyle-HorizontalAlign="Center" SortExpression="total_yards" />
<asp:BoundField HeaderText="YPP" DataField="yards_per_play" ItemStyle-HorizontalAlign="Center" SortExpression="yards_per_play" />
<asp:BoundField HeaderText="TO Margin" DataField="turnover_margin" ItemStyle-HorizontalAlign="Center" SortExpression="turnover_margin" />
<asp:BoundField HeaderText="APY" DataField="all_purpose_yards" ItemStyle-HorizontalAlign="Center" SortExpression="all_purpose_yards" />
<asp:BoundField HeaderText="Points" DataField="points" ItemStyle-HorizontalAlign="Center" SortExpression="points" />
<asp:BoundField HeaderText="Opponent" DataField="defense" ItemStyle-HorizontalAlign="Center" SortExpression="defense" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="SELECT [date], [offense], [rush_no], [rush_net], [yards_per_carry], [pass_att], [pass_yards], [yards_per_att], [no_plays], [total_yards], [yards_per_play], [turnover_margin], [all_purpose_yards], [points], [defense] FROM [cfb_boxscores] WHERE ([offense] = @offense)"
ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>">
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="offense" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</td>
<td valign="top">
<asp:SqlDataSource ConnectionString="<%$ ConnectionStrings:ConnectionString1 %>" ID="SqlDataSource3"
runat="server" SelectCommand="SELECT [date], [offense], [rush_no], [rush_net], [yards_per_carry], [pass_att], [pass_yards], [yards_per_att], [no_plays], [total_yards], [yards_per_play], [turnover_margin], [all_purpose_yards], [points], [defense] FROM [cfb_boxscores] WHERE ([date] = @date)">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1" Name="date" PropertyName="SelectedValue"
Type="String" />
</SelectParameters>
</asp:SqlDataSource>
</td>
</tr>
</table>
<br />
</form>
</body>
</html>
View 2 Replies
View Related
Apr 18, 2014
I've been trying some examples on line and have not been able to get this to work.
Here is my table followed by what I am trying to output.
Id | ParentId | CategoryName
33 | 0 | Fruits
34 | 0 | Vegetables
35 | 0 | Meats
37 | 33 | Grapes
38 | 33 | Oranges
[Code] ....
I want to output this for a dropdownlist in C# with ascending categories and ascended subcategories
48 0 Electronics
33 0Fruits
3933 -Apples
4033 -Bananas
3733 -Grapes
3833 -Oranges
[Code] ...
This is what I have currently, still a long way off :/
SELECT TOP (100) PERCENT fcat.Id AS fcat_id, fcat.CategoryName AS fcat_name, fcat.ParentCategory AS fcat_parent, fsub.Id AS fsub_id,
fsub.CategoryName AS fsub_name, fsub.ParentCategory AS fsub_parent
FROM dbo.ProductCategories AS fcat LEFT OUTER JOIN
dbo.ProductCategories AS fsub ON fcat.Id = fsub.ParentCategory
ORDER BY fcat_name, fcat_id, fsub_name
View 2 Replies
View Related
Jul 23, 2005
I've been tasked with designing a database to store collectiveagreements. I need to store each sub-article of each article of eachagreement in it's own row within a table. I'm having difficultyfiguring out the best way to store each sub-article's identifier sothey sort properly.The majority of the collective agreements use numbers in a dottednotation, for example:1.11.21.3.11.3.21.3.31.4Some agreements mix letters with numbers, such as:A-1.11.1.A.1Any ideas how I should deal with this?
View 4 Replies
View Related
Jan 21, 2008
can anyone please help on a sql statement that would sort out three kinds of data. let's say i have a column that contains a status flag. there are only 2 possible values, add and delete. now, i want to sort out three kinds of data: add_only, delete_only, and update. Update is the data that contains duplicate records in the table. Which means, there are two rows having same "student_number" but two different status flags. This happens when there's an update or change in data, such as new address or new phone number. The old row/data is sent with status flag of delete, while the updated data is sent with status flag of add. Example below. An output table with a new column of tag is created.
reports table
STUDENT_NO
NAME
ADDRESS
PHONE
STATUS FLAG
1
McKenzie
Ohio
9111111
add
2
Hario
New Jersey
1234567
add
3
Oda
Japan
9876543
delete
4
Davis
Chicago
1112222
add
5
Rodriguez
Detroit
4445555
add
1
McKenzie
Ohio
7778888
delete
4
Davis
Detroit
1112222
delete
create, remove, update table
STUDENT_NO
NAME
ADDRESS
PHONE
STATUS FLAG
TAG
2
Hario
New Jersey
1234567
add
create
5
Rodriguez
Detroit
4445555
add
create
3
Oda
Japan
9876543
delete
remove
1
McKenzie
Ohio
9111111
add
update
4
Davis
Chicago
1112222
add
update
Anyone knows what SQL statements to use to have this output? Thanks.
View 6 Replies
View Related
May 31, 2007
I need help in sorting data return from database. For example, I have the following data:ID field1 1 Computer 2 Cell Phone 3 iPod 4 Car I know that a select statement will look something like this: SELECT field1 FROM table ORDER BY field1. However, I want the data to be display this way in the gridview: ID field1
3 iPod
1 Computer
2 Cell Phone
4 Car Any idea of how I can make this happen. Any idea is appreciated.
View 11 Replies
View Related
Apr 9, 2008
Hi All,
I want to sort the column data which is of positive and negative number like the following.
-5823
-1
200
100
i want to sort like
-1
100
200
-5823
How can i do that can any one help me..
Thanks in advance.
-john
View 10 Replies
View Related
Nov 13, 2007
I want to select the below info from a sql 2005 db, to use it in a dynamic datadriven menu. Only problem, I don't know how to formulate my select statement. So here's the data
ID, TEXT HREF DESCR PARENTID
1
hMenu1
link1.htm
desc text
0
2
hMenu2
link2.html
desc text
0
3
sMenuM1
link3.htm
desc text
1
4
sMenuTSMenu3
link4.htm
desc text
3
I want the data structured so that below the row with id 1, would come it's subitems, subitems for the subitems and so on. So the recordset I'd like to return would in this case be:hMenu1
sMenuM1
sMenuTSMenu3
hMenu2
I've indented the data just to make things clearer. And finally, I want the substructure to be infinite at least in theory.I also do not want to use recursive logic to do this, if possible. I can change the structure of my table if neeed.Cheers!/Eskil
View 7 Replies
View Related
May 11, 2007
We have a requirement where in we need to sort the data after exporting to excel .But when we are trying to apply the filter on the excel and trying to sort we are getting an error ..
Is there any workaround for this??
View 1 Replies
View Related
Aug 28, 2007
Has anyone ever looked at the way the grid data viewer sorts it data when
clicking on a column header? If you click on a column header, something
happens to the sorting of the data in the viewer, but it's not always clear
to me _what_ is happening. It appears the data is sorted ascending on the
column you clicked on. If you click again the sort order seems to inverse to
descending. However, if you look closely, it turns out that the data is not
always sorted correctly, especially when you click on an integer valued
column.
I found this when doing a demo on the AdventureWorks demo extracting data
from the SalesOrderDetail table. If you sort on the OrderQty column, data is
correctly sorted in ascending quantities. However, if you click the column
again, orders with an order quantity of 2 are displayed on top (while there
are orders with a much higher order quantity) and if you scroll down the
list, you notice that there is no clear sorting anymore. The same happens
with other columns.
Is this supposed to work as I would expect it to do or is there a logical
explanation for the behaviour I see?
--
Best regards,
Hans Geurtsen
Docent Kenniscentrum
Info Support
De Smalle Zijde 39
3903 LM Veenendaal
The Netherlands
www.infosupport.nl
View 1 Replies
View Related