|
Thanqqqqqqqqqqqqqqqqqqqqqq
Harini.....
I am getting my result nowwwwwww....
Thats great
Actually iam new to sqlserver
This group is very helpfull for me ....
Thanq once again....
Naresh
|
|
|
|
|
You can try following SQL Statement:-
Select count(orders) from orderlist group by format(date,"mm-dd-yyyy") order by format(date,"mm-dd-yyyy").
The format can even be used for grouping by months.
Thanks
|
|
|
|
|
hi all,
i am a new guy..
i get good results from Recursive queries in sql server 2005 to count no of childs unde a node in a tree.
but now i am facing a problem ???
i have to define the level of a node ..
the case is as : starting from the rootnode of tree every node can have maximum of two node as left node and right node. not more than two node under a node.
so at level zero means root of node contains zero nodes.
suppose A is root of tree. first ledt node of A will be create afetr that right node a will be create. now A have two members under him so A is now at level one.
as suppose A have two node B(left)/C(right). and node B contais D/E as left right node and C(right of A ) contains F/G as Left/right node than at this level B exactly contains two nodes under him as well as C conyais two nodes . so binary has been complete. so now A is at level two.
now D has left only and G has only left node so at this level D E F G are uncomplete (having less tahn two nodes ) so now a is at two level.
so this is the pattern for that structure..
so have to et the level for every node in the tree.
now can i do
i am using asp . net 1.1/C# and sql server 2005.
This is the table structure for above :---
-------------------------------------------
Id name ParentId Left Right
--------------------------------------------
1 A -1/null 0 1
------------------------------------------
2 B 1 0 1
-------------------------------------------
3 C 1 0 1
--------------------------------------------
4 D 2 0 -1
----------------------------------------------
5 E 2 -1 -1
----------------------------------------------
6 F 3 -1 -1
-----------------------------------------------
7 G 3 0 -1
------------------------------------------------
8 H 4 -1 -1
--------------------------------------------
9 I 7 -1 -1
-----------------------------------------------
parent of A has null or -1 as reference .if a node has keft child that is represent by zero and for right one .
if a node does not contains any node this left=right will be -1;
so plz help me how can i set the level of a node in the tree.
the depth can be up to 50,000 node.
jh hsg sabdhas avdhagd advahgd axva
|
|
|
|
|
Hi in my table i have two records for the same employee in different dates...,
Now i want display the latest record of the employee how to do it??,
Example:
table like:
Id date sala1
1 3/20/2007 10000
2 3/20/2007 23000
1 5/24/2007 15000
3 6/31/2007 24000
see the above table id=1 have two records in different dates...,
now i want to show only the latest record it means:
want to display only the following record...,
Id date sala1
1 5/24/2007 15000
how to do it please help me...,
-- modified at 1:59 Thursday 24th May, 2007
Magi
|
|
|
|
|
select top 1 * from where id='1' order by Date asc
Thanks and Regards
Navneet Hegde
Nashik
Develop2Program & Program2Develop
|
|
|
|
|
Ya its working,
But order by date desc only getting correct output..,
Thanks lot for ur reply...,
Keep in touch,
Magi
|
|
|
|
|
Select MAX(Date)
From YourTable
Group by Id
maybe this can help you
|
|
|
|
|
Hi all,
How to cluster tables in sql 2005
|
|
|
|
|
Please First Refer to Books for such stuff, if you find anything difficult to understand then CODEPROJECT welcomes you.
Thanks & Regards
Navneet Hegde
Nashik
Develop2Program & Program2Develop
|
|
|
|
|
I posted my message since i did not find any relevant info from any books or else i would not ve posted
|
|
|
|
|
By clustering do you mean relationships?
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
Hiiii... all....
I have a table called "orders" ..
In that table ive some orderslist for particular dates ... then r not in certain order ...
now i want to count the records stored in particular date , and i want to display only the "date and total orders ( count ) done in that particular date ...
..............
like ,
Date TotalOrders(Count)
1/5/2007 50
2/5/2007 45
3/5/2007 80
LIke this ... plz help me
Thanks in adv
Naresh
|
|
|
|
|
select OrderDate, count(OrderID)
from tblOrder
where OrderDate between '2007-01-01' and '2007-03-31'
group by OrderDate
----------------------------------------------
Damian - still with no useful signature...
|
|
|
|
|
Hi Thanks Alot but
iam not getting result exactly ....
I think the problem is with the time .... iam having datetime not only date ...
I tried like this
select orcvddatetime, count(OurORef) from ordermain group by orcvddatetime
Now am getting the count but its depends on time, i need the result based on date ,
now
my query is
---------
select orcvddatetime, count(OurORef) from ordermain where orcvddatetime between '2007-03-12 10:07:00' and '2007-02-13 06:07:00' group by orcvddatetime
---------
but iam getting empty data
it is showing like this >>>>
orcvddatetime (No column Name)
Its empty...
i dont kw the reason ...
my column names r correct n the some is also there in my table ordermain
Actually am new to this environment ... plz help me ...
Thanks in advance
naresh
|
|
|
|
|
try to use convert function to extract date from ur field
select count(*) as [No Of Orders],convert(varchar,CreatedDate,103) as OrderedDate from inv_drugorder
where convert(varchar,CreatedDate,103)='11/05/2007'
group by convert(varchar,CreatedDate,103)
if it is not working or showing some errors pls mail me
sdf
|
|
|
|
|
please tell me how to find the 10th highest paid employee in an employee table whose attributes are empid,ename,sal,age,deptno
regards
saravan
|
|
|
|
|
try this:
select empid from where sal=
select sal from (select sal from group by sal order by sal desc )
where rownum=10
|
|
|
|
|
use tblEmployee
SELECT TOP 1 *
FROM (SELECT TOP 10 *
FROM tblEmployee order by sal) A
ORDER BY A.sal DESC
-- modified at 2:10 Thursday 24th May, 2007
Develop2Program & Program2Develop
|
|
|
|
|
Hi,
Is there a tool available which can convert SPs from Oracle to Sql Server style and vice versa.
Regards,
Blumen
|
|
|
|
|
Hi All!
i have column1 which has some values in it. i want column2 to calculate the sum of the values in column1 in each cell as shown below:
CL1 CL2
10 10
25 35
32 67
12 79
56 135
what is the query i need to write in order to acheive this.pl help me out.thanking in advance!!!
|
|
|
|
|
Since a databases work on the concept of sets of data there is no intrinsic order in which the data exists. The implementation of the database software may make it appear that data is in a certain order, but that cannot be relied upon.
In order to do what you want, you must first find a way to determine order. That might be through a primary key you already have, but didn't mention, or the creation of a new column that defines the order of the rows.
|
|
|
|
|
Ok, actually you can do this very easily. Simply use a reader to read all the values in column 1 and add them to the same variable. Then add the value of the new insert to that same variable. That variable will be you value for column 2. I can explain better if you don't understand.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
ExpertComing wrote: Ok, actually you can do this very easily. Simply use a reader to read all the values in column 1 and add them to the same variable. Then add the value of the new insert to that same variable.
You haven't taken into consideration the order of the rows. The OP has given no indication of how he determines the order. So, how do you know you are reading the rows in the correct order? Remembers any order that the rows appear in the result set are merely a quirk of the implementation and not guaranteed.
|
|
|
|
|
He is looking for a sum. With a addition(sum) order doesn't matter.
2+1=3
1+2=3
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|
|
Oh, I understand what you mean now. Let me think about how to do it, I have an idea but I want to think about it to make sure that it will work.
The only way to speed up a Macintosh computer is at 9.8 m/sec/sec.
|
|
|
|