I want get the time used for a case so I can create an overview.
The SELECT query for the cases looks like this:
SELECT bc.id, bc.title, bc.estimateCurrent FROM cases bc
For one case I can get the used time like this:
SELECT SUM(TIME_TO_SEC(TIMEDIFF(dateEnding, dateBeginning))) AS calculatedTime FROM timesheet WHERE `#case` = ?
...
Hi,
I have a table with devices, their buyed country and their buyed date.
I want to retrieve :
- the total number of devices by country
- and the number of devices buyed since 1 month for each country.
I use this request to make this :
SELECT countryCode, COUNT(*) AS sinceBeginning, (
SELECT COUNT(*)
FROM mytable
WHERE countryCode...
Hello, how I can create a query in Oracle for "angel" no matter if it is Angel, ANGEL, angel AngEl
...
I have worked with several big databases and the names of stored procedures were very different:
SP_PrefixXXX
PrefixYyyXxx
Prefix: Rep, Act
What's the best practice of naming? How can I organize them in a proper way?
...
How can I UPDATE a field of a table with the result of a SELECT query in Microsoft Access 2007.
Here's the Select Query:
SELECT Min(TAX.Tax_Code) AS MinOfTax_Code
FROM TAX, FUNCTIONS
WHERE (((FUNCTIONS.Func_Pure)<=[Tax_ToPrice]) AND ((FUNCTIONS.Func_Year)=[Tax_Year]))
GROUP BY FUNCTIONS.Func_ID;
And here's the Update Query:
UPDATE...
One application causes a heavy load on our Sql Server 2005 database. We don't control the application that runs this query hundres of times a minute:
select id,col1,col2,col3 from table where id != id
Note the id != id, meaning a row is not equal to itself. Unsurprisingly, the result is always no rows found. However, Sql Server does a...
I am currently working on developing some SQL scripts in PL/SQL Developer and I am getting an "SQL Command not properly ended" error that I am unsure how to solve.
The code I am using looks something like this
CREATE TABLE temp_table as
SELECT * FROM table_x
INSERT INTO temp_table
SELECT * FROM table_y
If I execute the two ...
Let's say I have two or more tables filled with users and I want to retrieve all users from those tables in the same query.
Tables share some columns and those columns that have the same name are the ones I'm trying to retrieve.
Something like:
SELECT name, age FROM users1;
SELECT name, age FROM users2;
etc.
Note: this is just an ex...
Hello all,
I am wondering if there is an elegant way to check for the existence of a DB? In brief, how do test the connection of a db connection string?
Thanks
...
Please, can anyone explain me what is the difference between Index Rebuilding and Index Reorganizing? Thanks in Advance
...
I have a database showing up in SQL Enterprise Manager as "(Restoring...)"
If i do SP_WHO there is no restore process.
The disk and CPU activity on the server is very low
I think it is not restoring at all.
How can I get rid of this?
I've tried renaming the underlying MDF file, but even when I do "NET STOP MSSQLSERVER" it tells me t...
It seems like a no brainer to me. I've heard countless stories about people forgetting the WHERE clause in an UPDATE or DELETE and trashing an entire table. I know that careless people shouldn't be issuing queries directly and all that... and that there are legitimate cases where you want to affect all rows, but wouldn't it make sense to...
I am trying to insert a row into a table, using a value that is derived from another table. Here is the SQL statement that I am trying to use:
INSERT INTO NextKeyValue(KeyName, KeyValue) SELECT 'DisplayWorkItemId' AS KeyName, (MAX(work_item_display_id) + 1) AS KeyValue FROM work_item;
So, I am trying to create a row in NextKeyValue t...
Hey all,
I just installed SQL Server 2005 on my machine and now I am trying to connect to it via SQuirrel SQL, but I am unfortunately running into problems.
When installing SQL Server 2005 I chose mixed mode for authentication and I have set up a new user account with which I am trying to connect. I also have installed the Microsoft SQ...
Is there a way to only show the first N lines of output from a SQL query? Bonus points, if the query stops running once the N lines are outputted.
I am most interested in finding something which works in Oracle.
...
Hi,
When I placed the the following SQL query,
SELECT
[ItemID], [Name], [RelDate], [Price], [Status]
FROM
[item_k]
WHERE
[ItemID] IN (" + itemIDs + ")
in gridview custom sql statements, it gets transformed to,
SELECT
ItemID, Name, RelDate, Price, Status
FROM
item_k
WHERE
(ItemID IN ([ + itemIDs + ]))
a...
We use Source Safe and are migrating to Source Gear. We know that we have sql objects (procs, triggers, views, functions) that are in sql but were never added to the source code repository. What is the best way to hunt those down so I can add them?
...
What is the syntax to drop multiple columns in DB2? I tried this:
ALTER TABLE work_item DROP COLUMN (TRANSACTION_TYPE, REQUEST_TYPE, LOCATION_CODE, ROLE_ID, SUBMITTED_BY);
But it didn't work. I am running on AIX (from what I read, it looks like maybe you cannot drop columns at all on platforms other than AIX).
If I drop the columns...
I am wondering if you can use Linq to SQL using a .mdf file on a machine without a SQL Server instance installed?
...
hi,
I have a string named itemIDs separated by commas(12,43,34,..) and in order to use it as a parameter i need to convert it to int since the itemID in the db is in int format.
this is what i wrote but i get an error saying Incorrect syntax near the keyword 'as'.
using (SqlCommand searchResult = new SqlCommand("SELECT ItemID, Name, R...