sql

Can you define values in a SQL statement that you can join/union, but are not stored in a table outside of the statement?

I'm trying to create a query and need to join against something that I can define values in without creating a table. I'll attempt to describe what I'm trying to do: table1 ------- fieldA is joined on fieldA with table2 ------- (titles for FK in table 1) Table1 has values outside of what exists in table2 I want to add an addit...

does mysql undo changes if you kill thread?

i ran a delete rows query. it was taking too long so i killed the thread from administration. did it undo the changes to the table/? ...

T-SQL Question - Counting and Average

I have a set of data that consists of a filenbr, open date and close date. I need to produce a summary table similar to the below, i need to count how many files belong to each day period, but i need those greater than 20 grouped together. I know how to get the datediff, what i'm stumbling on is how to get the 20+ and the % column 1 d...

delete records from a table based on data from a different table

table1 has column CITY and COUNTRY. table2 has column CITY. how do i delete from table2 all records that have CITY in common with table1 but also the COUNTRY='Russia' ?? please keep in mind that both tables have about 1 million rows of data ...

estimating how long a delete statement should take in mysql

DELETE table2 FROM table2 INNER JOIN table1 ON table2.CITY = table1.CITY WHERE table1.COUNTRY = 'Russia' both tables have about half a million records, about 10 columns each. each column is not larger than about 100 characters how long will this take if there are about 250,000 records matching the criteria? ...

SQL query that returns columns form table A plus a bit column that specifies with the PK of table A exists in table B

How can I write an efficient SQL query that returns columns form table A plus a bit column that specifies whether the PK of table A exists in table B? I am using MS SQLServer 2005. Thanks. ...

How to reference the SQL column description field through the DBML?

I would like the SQL column description property to hold the friendly name of the column to display to the users. Is there a way that I can reference this column property through the DBML? Update: We ended up writing a c# method that injects a space into a camel case string and renaming the DB columns to be more friendly. ...

Simple check for SELECT query empty result

Hi. Can anyone point out how to check if a select query returns non empty result set? For example I have next query: SELECT * FROM service s WHERE s.service_id = ?; Should I do something like next: ISNULL(SELECT * FROM service s WHERE s.service_id = ?) to test if result set is not empty? ...

Programming /open source / Beginner

Possible Duplicate: How to get involved in an open source project I m a CS UG student Wanaa know How to participate in open source projects ? Which one will be good for beginner in C ,Java ? Interests include web appln and db ? exactly wana ask is that how source forge will help for starting ... I found the codes very complic...

What is the 'noreq' Filter Type an Alias for?

I'm looking in to Magento's filtering options (Ecommerce System and PHP Framekwork with an expansive ORM system). Specifically the addFieldToFilter method. In this method, you specify a SQLish filter by passing in a single element array, with the key indicating the type of filter. For example, array('eq'=>'bar') //eq means equal arra...

delete taking really long time! mysql

i am doing this: delete calibration_2009 from calibration_2009 join batchinfo_2009 on calibration_2009.rowid = batchinfo_2009.rowid where batchinfo_2009.reporttime like '%2010%'; both tables have about 500k lines of data i suspect that 250k match the criteria to be deleted so far it has been running for 2 hours!!! is there something ...

ms-access: filling out an application by printing over it

i will be printing the access report. the report will not be printed a regular white paper. it will be printed on top of a paper with checkboxes and fields on it. i need those checkboxes and fields to be printed on according to the access data. are there any libraries for access that make this easier? is there a feature that will help t...

Ways to implement tags - pros and cons of each

Related Using SO as an example, what is the most sensible way to manage tags if you anticipate they will change often? Way 1: Seriously denormalized (comma delimited) table posts +--------+-----------------+ | postId | tags | +--------+-----------------+ | 1 | c++,search,code | Here tags are comma delimited. Pros...

MySQL: what is a temporary table?

What is the purpose of a temporary table like in the following statement? How is it different than a regular table? CREATE TEMPORARY TABLE tmptable SELECT A.* FROM batchinfo_2009 AS A, calibration_2009 AS B WHERE A.reporttime LIKE '%2010%' AND A.rowid = B.rowid; ...

How to test if a SQL Server 2008 database can serve 200 concurent users

I have a SQL Server 2008 database in 3NF. I must check if the db can support many concurent users. Which is the best method ? Is there any free tool to do this ? Thank you very much. ...

SQL concatenate rows query

Say we have a table table posts +---------+-----------+--------------------------------+ | postId | title | status | bodyText | +---------+-----------+--------------------------------+ | 1 | Hello! | deleted | A deleted post! | | 2 | Hello 2! | deleted | Another one! | | 3 | New 1 ...

How can I optimize retrieving lowest edit distance from a large table in SQL?

Hey, I'm having troubles optimizing this Levenshtein Distance calculation I'm doing. I need to do the following: Get the record with the minimum distance for the source string as well as a trimmed version of the source string Pick the record with the minimum distance If the min distances are equal (original vs trimmed), choose the trim...

SQL Server: Find Values that don't exist in a table

I have a list or set of values that I would like to know which ones do not currently exist in a table. I know I can find out which ones do exist with: SELECT * FROM Table WHERE column1 IN (x,x,x,x,x) The set is the values I am checking against. Is there a way to find out which values in that set do not exist in column1? Basically, I'm...

How do you escape double quotes inside a SQL fulltext 'contains' function?

How do you escape a double quote character inside a MS SQL 'contains' function? SELECT decision FROM table WHERE CONTAINS(decision, '34" AND wide') Normally contains() expects double quotes to surround an exact phrase to match, but I want to search for an actual double quote character. I've tried escaping it with \, `, and even anoth...

Assign the results of a stored procedure into a variable in another stored procedure

The title of this question is a bit misleading, but I couldn't summarize this very well. I have two stored procedures. The first stored procedure (s_proc1) calls a second stored procedure (s_proc2). I want to assign the value returned from s_proc2 to a variable in s_proc1. Currently, I'm calling s_proc2 (inside s_proc1) in this manner:...