Query:
select `r`.`id` as `id`
from `tbl_rls` as `r`
left join `tblc_comment_manager` as `cm` on `cm`.`rlsc_id` != `r`.`id`
Both tables has 8k records but why it is too very slow taking 2-3 minutes and more sometime.
OMG , this query makes mysql server down. Will get back to you peoples in a second :(
All peoples those sug...
Hi all,
I have undertaken a small project which already evolved a current database. The application was written in php and the database was mysql.
I am rewriting the application, yet I still need to maintain the database's structure as well as data. I have received an sql dump file. When I try running it in sql server management studi...
Hi, is there a way I can write a script to find all tables with a given filter (e.g. all tables that start with "tbl_") and copy them (structure only) but adding a new standard column to each one?
I'm using SQL server 2008.
Thanks in advance.
...
First of all, I know this SHOULDN'T work. We're using a very old DAL/ORM (Pear/DB/GenericDao based) layer that incorrectly surmises that id is not an autoincrement/integer field.
This statement DOES work in 5.0 Linux, DOES NOT work in 5.1 Windows. Is there a setting that could be different in my ini (ignore_type_errors="yes":))? I ...
Say i have a query "select username from users". I want to output this query onto a PHP page but after every 10th row i want to display my own custom text. Any ideas?
...
Hello everyone,
I am using SQL Server 2008 Enterprise with Windows Server 2008 Enterprise. I have a database table called "Book", which has many columns and three columns are important in this question, they are
Author, varchar;
Country, varchar;
Domain, varchar.
I want to write a store procedure with the following logics, but I do ...
Is it possible in relational databases for these two statements to deadlock? I'm trying to simplify my question and example -- please just assume that these selects, which I think would normally only require sharable read-locking, now require exclusive read locks:
Concurrent Connection 1:
SELECT {...}
FROM A
JOIN B ON {...}
Concurren...
Visual Studio 2005 I connect with SQL Server Express edition with SQL Server Management Studio Express using Windows authentication.
When I installed Visual Studio 2005 I didn't get asked for SQL Server Express edition user name or password. How can I connect without Windows authentication ?
...
I have the following table:
Table: UserName
Userid User UserUpdate
1 Dan 1/1/2005
1 Dan 1/1/2007
1 Dan 1/1/2009
2 Pam 1/1/2005
2 Pam 1/1/2006
2 Pam 1/1/2008
3 Sam 1/1/2008
3 Sam 1/1/200...
Here is my problem. I am creating 4 temp tables to count specific types of boxes and an employee's hours. Given a beginning date and ending date we want to know total boxes of each type (1, 2, and 3) and their total hours worked in that time period. All works perfectly if there is at least one of each type, but if only two types are pres...
I want to display rows as column in SQL Server.
My table looks like this:
images_id item_id images_name
-------------------------------
1 1 image1.jpg
2 1 image2.jpg
3 1 image3.jpg
4 2 image4.jpg
5 2 image5.jpg
6 2 image6.jpg
I'd ...
Hello,
I have a column MetaKeys in my employee table. It contains a value like the one shown below:
MetaKeys="DocType=1***SubDocType=2***MinValue=123"
How do I query my table and fetch just the SubDocType value from MetaKeys column?
Select * from employee where Metakeys contains SubDocType=2
...
What happens to the system agent tables whenever the database server is restarted? More specifically, does SQL Server assign new job_ids to each job when they are run after the reset, or does the job_id stay the same?
...
I have following two tables:
Person {PersonId, FirstName, LastName,Age .... }
Photo {PhotoId,PersonId, Size, Path}
Obviously, PersonId in the Photo table is an FK referencing the Person table.
I want to write a query to display all the fields of a Person , along with the number of photos he/she has in the Photo table.
A row of the ...
I am a student this is my LAST homework assignment : )
/*
**(4.9) Calculate the minimum salary for exempt employees
**and the maximum salary for non-exempt employees.
*/
I can only use one select statement... or without running two separate queries
I have 2 tables...
Job_title
(Job_title varchar (50) PRIMARY KEY,
EEO_1_Classificatio...
i would like to have a BAT file open a sql server script
currently i have this code in the sql file:
declare @path varchar(255), @mydb varchar(50)
SELECT @mydb = 'timeclockplus'
select @path = 'C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\Backup\' + @mydb + '-' + convert(varchar(8),getdate(),112) + '.bak'
BACKUP DATABASE @mydb T...
I'm trying to form a query that returns a list of entities within a given rectangle, using SDO_WITHIN_DISTANCE. The query I've made seems like it should work, but Oracle is giving me some strange errors. Here's the query:
SELECT *
FROM TBLENTITYLOCATION TL
INNER JOIN TBLENTITY TE
ON TE.ENTITYID=TL.ENTITYID
WHERE SDO_WITH...
I'm having an issue with temp tables using an ADO connection to my database. The select into queries run fine, but it seems that they are dropping the tables after each select into. Their is no open recordset so I am unsure as to why the tables are dropping, it shouldn't be opening a 2nd ADO connection that I can see.
Any idea what I ca...
I write PSQL script and using variables (for psql --variable key=value commandline syntax).
This works perfectly for top level scope like select * from :key, but I create functions with the script and need variable value inside them.
So, the syntax like
create function foo() returns void as
$$
declare
begin
grant select on my_tabl...
I know, from whatever I've read, prepared statements are faster since pre-compiled cached version is used for recurring queries. My doubt is : Exactly where time is saved? I see, only the time taken in preparing a query could be saved. Even prepared statements have to do database search and so no time is saved there. Am I wrong?
...