|
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.
|
|
|
|
|
Good morning
In messages system i have table to store messages and another table to contain the links which the message is posted through
Now i want to delete a link but i don't want to delete the message sent through this link
The problem:
When displaying the message sent what will be fount in the link field (i.e for the deleted link)
I tried to move the deleted link data to separate table (EX: deletedLink) but if the user added new link with the same name as the deleted link? The problem mainly in when displaying the message sent i will have the same link twice one for the deleted and the other for the added one.
If any one has a good idea for doing that please reply to me
I don’t want the sql code
I want just the idea
Thanks
mohammed Al maghraby
|
|
|
|
|
Here is one idea:
Check the table to see if that user has already added that link. If they have prompt them at that time to overide the existing link or to cancel.
Ben
|
|
|
|
|
First Thanks for interest
There is misunderstanding in the problem
I have to enable the user to a link with the same name because the original link supposed to be deleted
I.e. it doesn't appear in the forms of the application
So the user thinks that the link was deleted
Again
i want to delete the link because it became useless for me but at the same time there are message in the message table which are related to that link
And I don't want to delete them
Also at the same time after deleting the link the user wants to view a report about the messages which contain information about the link used for sending these messages
, after deleting the link where could I get the link information?...that is the problem
I hope the situation is clear
Again thanks for interest
Kind regards
mohammed Al maghraby
|
|
|
|
|
Ok, in that case add a new column called deleted or historical. The active link is set to 0 a link that has been deleted is set to 1. So when you return that link only return with a value of 0.
Hope that helps.
Ben
|
|
|
|
|
Hi,
I want to connect a computer with a remote sql database ( in a local network).
I wrote an application which opens a SQlConnection with the help of a connection string.
When I run this application at the server, there is a connection to the database.
When I run this application on my client, it says: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.
I tried to change my connection string many times, but it won't work. The two computer can reach each other with ping.
Can you help me?
code snippet:
string strDatabase="_Hanna1";
string strServer="IS65PJ11\\WinCC" ;// this is the name of my server
strConnectionString = "Integrated Security=SSPI;" +"Persist Security Info=False;User ID=sa;Initial Catalog=" +strDatabase + ";Data Source=" + strServer;
// I tried the connection string also without "User ID=sa", but than its the same error
SqlConnection SQLCon = new SqlConnection(strConnectionString);
thanks in advance!
|
|
|
|
|
Hi,
Generally DataSource should be an IP address or Machine name of the SQL Server. Try to connect to database using SQL Enterprise Manager. Then you will know correct machine name, user id and password.
Harini
|
|
|
|
|
Hi Harini!
thanks for you answer!
I finally found the mistake, I got something wrong with my users.
I set an sql user and my client application can log in with this sql user.
but i had to remove the first two statements: "Integrated Security=SSPI;" +"Persist Security Info=False",
do you know if this does any "harm" ?
Leia2011
|
|
|
|
|
Leia2011 wrote: do you know if this does any "harm" ?
If you want to use SQL logins then you need to remove it. It tells SQL Server that you want to use Windows Authentication.
|
|
|
|
|
i have a datagridview in a form application,and now i want del
a row which i selected from datagridview . who can give a advise or example?
|
|
|
|
|
:-Dhi 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.
-- modified at 2:31 Thursday 24th May, 2007
-- modified at 2:34 Thursday 24th May, 2007
jh hsg sabdhas avdhagd advahgd axva
|
|
|
|
|
You may want to rename the title of your post. It sounds like you are demanding someone write the query for you. Since this is your first post, I recommend you read the forum guidelines.
__________________
Bob is my homeboy.
|
|
|
|
|
Hi
I am doing an application in which I am using a XML file to populate a datagrid.
In that XML file I have one like.....
<>
1.To generate leads efficiently and profitably.
2.To ensure that all details are collected in one call.
3.To provide email and chat support.
4.To manage Work Basket reports as required.
5.To meet targets for both quantity and quality.
<>
When I am trying to populate this column onto datagrid, all these lines or sentences are getting combine and displaying like a paragraph.
I want to know how to format this column to get them in the a new line
Thank u
Chandu
Thank u
Chandu
|
|
|
|