This is part two of the question: http://stackoverflow.com/questions/2913639/mysql-make-this-query-faster-theres-a-way
this query still run slowly:
SELECT b.id,
b.name,
c.name
FROM bookcorr as a JOIN books as b on b.id = a.books_id =
JOIN Library as c on c.id = a.library_id
WHERE a.category_id = '2521'
AND a.library_id ...
I have a LINQ to SQL query that when executed does not return any data. However, when I debug, I can take the generated SQL query, plug in the values for the variables, and run it in SQL Management Studio to get the record I'm expecting. I'm taking the values for the variables while in debug mode as well.
Has anyone experienced someth...
I have developed my own word breaker for SQL 2005 and the Full Text Search feature. I know how to use it by simply hijacking an existing language and add the wordbreaker to the registry for the hijacked language. However I'm not completely satisfied with that solution. I want to create a completely new language is this possible?
...
Hi,
I am using SSIS to transfer data from MS SQl server as data source and Sharepoint list as data destination. Now, I need to fire an update command on the sharepoint list. Please guide me to implement this.
...
Hi Guys,
A simple question about Stored Procedures.
I have one stored procedure collecting a whole bunch of data in a table. I then call this procedure from within another stored procedure. I can copy the data into a new table created in the calling procedure but as far as I can see the tables have to be identical.
Is this right? Or i...
Hello,
I am facing a problem that occasionally comes up when you deal with not fully normalized table. Here is the problem. Imagine a table with 4 columns, and let's call this table dbo.Hierarchical. Here is the definition of the table:
if OBJECT_ID('dbo.Hierarchical') is not null
drop table dbo.Hierarchical
create table dbo.Hierarch...
I have CMS table that contain CMS_STARTTIME and CMS_STOPTIME (attachment).
I want to create report to summarize exist data by using Date, Time and Year as Parameter (attachment).
I don't know how to create sql statement to meet this requirement. I'm using MySQL and MS-SQL.
Does one can help?
Thank you very much.
...
I am interested in implementing an architecture that has two databases one for read operations and the other for writes. I have never implemented something like this and have always built single database, highly normalised systems so I am not quite sure where to begin. I have a few parts to this question.
1. What would be a good resourc...
I have read these very good questions on SO about SQL stored procedures:
When should you use stored procedures? and
Are Stored Procedures more efficient, in general, than inline statements on modern RDBMS’s?
I am a beginner on integrating .NET/SQL though I have used basic SQL functionality for more than a decade in other environment...
I have a SQL data reader that reads 2 columns from a sql db table.
once it has done its bit it then starts again selecting another 2 columns.
I would pull the whole lot in one go but that presents a whole other set of challenges.
My problem is that the table contains a large amount of data (some 3 million rows or so) which makes workin...
Hello all,
Here's a dumb question which I can't find an answer to:
I have a table which contains 20 fields, a few of which are date/time. I am interested in pulling all the fields. I would like to pull the datetime fields using the to_char function but don't want to individually list out all the other fields. Is there an easy way to do ...
I need to be able to select only the first row for each name that has the greatest value.
I have a table with the following:
id name value
0 JOHN 123
1 STEVE 125
2 JOHN 127
3 JOHN 126
So I am looking to return:
id name value
1 STEVE 125
2 JOHN 127
Any idea on the MSSQL Syntax on how to perform this operation?...
I want to basically join these 3 table in a view for a report:
Class Table:
ID Name
1 N1
2 N2
3 N3
Flags Table:
ID ClassID Flags
1 1 F1
2 1 F2
3 2 F6
4 2 F3
5 3 F2
Sessions Table:
ID ClassID Sessions
1 1 S1
2 1 S4
3 2 S3
4 3 S...
Hello I have a database for a certain record where it needs to store a 1 or a 0 for each day of the week. So which one would be better? Bitshifting each bit into an integer and just having an integer in the database named days or should we make all of them separate boolean values so to have sunday, monday, tuesday... columns?
Note that ...
This is what I'm doing:
while (@counter < 3 and @newBalance >0)
begin
CASE
when @counter = 1 then ( @monFee1 = @monthlyFee, @newBalance = @newBalance-@fee)
when @counter = 2 then ( @monFee2 = @monthlyFee, @newBalance = @newBalance-@fee)
END
@counter = @counter +1
end
I get this error:
Incorrect syntax near the keyword 'CASE...
Possible Duplicates:
What is the difference between a primary key and a unique constraint?
Primary key or Unique index?
i need to change one of the fields of a table to auto increment and to be the primary key. what does unique index mean?
...
i am running mysql and i would like to display the last 10 records that were added. what is the select statement for this?
...
I have a table "Families", like so
FamilyID PersonID Relationship
-----------------------------------------------
F001 P001 Son
F001 P002 Daughter
F001 P003 Father
F001 P004 Mother
F002 P005 Daughter
F002 P006 Mother
F003 P007 Son
F00...
Below is what I'm trying to do with by iterating through the records.
I would like to have a more elegant solution if possible since I'm sure this is not the best way to do it in sql.
set @counter = 1
declare @totalhrs dec(9,3), @lastemp char(7), @othrs dec(9,3)
while @counter <= @maxrecs
begin
if exists(select emp_num from #tt...
How can I copy the value of a field, but only its numbers?
I am creating a computed column for fulltext search, and I want to copy the values from my Phone Number fields (which are varchar) into it, but not with their formatting - numbers only. What is the command that would do this in my computed column formula?
Thank you!
...