I'm trying to sort a list of titles, but currently there's a giant block of titles which start with 'The '. I'd like the 'The ' to be ignored, and the sort to work off the second word. Is that possible in SQL, or do I have to do custom work on the front end?
For example, current sorting:
Airplane
Children of Men
Full Metal Jacket
Pu...
I cannot understand the syntax error in creating a composite key. It may be a logic error, because I have tested many varieties.
How do you create composite keys in Postgres?
CREATE TABLE tags
(
(question_id, tag_id) NOT NULL,
question_id INTEGER NOT NULL,
tag_id SERIAL NOT NULL,
...
I have a query to get duplicate data with some extra condition but I feel that it is not fast enough. Any solution to make this query faster?
v_listing contains big information
SELECT DISTINCT code, name, comm, address, area
FROM v_listing t1
WHERE EXISTS (SELECT NULL
FROM v_listing t2
WHERE t1.comm = t2...
Here's a sample table to help illustrate my problem:
mysql> select * from test;
+----+--------------+--------+
| id | type | siteid |
+----+--------------+--------+
| 1 | First Visit | 100 |
| 2 | Second Visit | 100 |
| 3 | First Visit | 300 |
| 4 | First Visit | 400 |
| 5 | Second Visit | 500 |
| 6 | Sec...
Mulling over something I've been reading up on.
According to Chris Webb,
A linked measure group can only be
used with dimensions from the same
database as the source measure group.
So I took this to mean as long as two cubes share a database, a linked measure group can be used with a dimension. So I created a new cube and ad...
OK. I've read things here and there about SQL Server heaps, but nothing too definitive to really guide me. I am going to try to measure performance, but was hoping for some guidance on what I should be looking into. This is SQL Server 2008 Enterprise. Here are the tables:
Jobs
JobID (PK, GUID, externally generated)
StartDate (datetime...
Hello
I have a table that has a lot of duplicates in the Name column. I'd
like to only keep one row for each.
The following lists the duplicates, but I don't know how to delete the
duplicates and just keep one:
SELECT name FROM members GROUP BY name HAVING COUNT(*) > 1;
Thank you.
...
Hi
Can anyone tell me how I can control the output from an SQL stored procedure that returns more than one set of output?
I am currently doing the following:
DataTable allData = new DataTable();
SqlConnection connection = new SqlConnection(mySource);
SqlCommand cmd = new SqlCommand(procedureName, connection);
...
I'm not very familiar with the console application but i think its kind a interesting subject to learned. I searched for tutorials and references related to connecting MySQL database in console but no luck. So i just try and error. Please correct me I'm wrong..
I had an application where when user run the program, it'll store values to ...
I have the following SQL query and so far it works the way it should and gets the top 40 tag ids that I have stored in the tagmap table.
SELECT TOP 40
tbrm_TagMap.TagID,
Count(*)
FROM tbrm_TagMap
GROUP BY tbrm_TagMap.TagID
ORDER BY COUNT(tbrm_TagMap.TagID) DESC
I also want to join to the Tags table which contains the actual name of ea...
Hi,
I have the following problem:
I have an account table and an entries for account table.
account_id
account_name
entry_id
account_idfk
entry_date
entry_amount
Now I want to query all entries for all accounts in a given period. Eg. I want all Entries for all accounts from October 2008 - October 2009. If there are no entrie...
I've added a field to a MySQL table. I need to populate the new column with the value from another table. Here is the query that I'd like to run:
UPDATE table1 t1
SET t1.user_id =
(
SELECT t2.user_id
FROM table2 t2
WHE...
I have a simple query which loops and I want to see the PRINT messages during the execution. The query is something like this:
WHILE 1 = 1
BEGIN
WAITFOR DELAY '000:00:10'
PRINT 'here'
END
The PRINT 'here' does not output until I stop the process, however, I want to see it while its running. Is this possible?
...
I need:
Plain SQL that I can run without modification with sqlcmd.exe to insert testdata into testdatabase.
I have:
Service calls and entities to generate the insert operations with NHibernate.
Not working solution:
Log output to text-file. NHibernate generates parameterized sql but logs them in a format not runnable by sqlcmd.exe.
...
Hi All:
There is a column whose datatype is Date. While showing the results, it has to display date along with the time. How to give that in query?. Thanks in advance.
...
Hello,
If I had a table like this:
jobId, jobName, Priority
Whereby Priority can be an integer between 1 to 5.
Since I would need this query for generating a chart on report, I would need to display the jobid, jobname and 5 fields called Priority1, Priority2, Priority3, Priority4. Priority5.
Priority1 should count the amount of r...
In our environments, sometimes the case changes. Id becomes ID and then morphs into id.
When this happens, my SSIS packages (sql server 2008) fail because the column name is not the same case as expected.
Here is a way to reproduce the problem. In your Dev SQL Server, create the following tables:
DROP Table dbo.CartoonCharacters
Go
Cr...
We've got some SQL code I'm trying to optimize. In the code is a view that is rather expensive to run. For the sake of this question, let's call it ExpensiveView. On top of the view there is a query that joins the view to itself via a two sub-queries.
For example:
select v1.varCharCol1, v1.intCol, v2.intCol from (
select someId, va...
I've got a small Windows network with 3 machines. One of them has SQL 2005 installed. As of last week, the other two machines have had no problems connecting to the SQL instance.
Today, one machine - running Vista, if that matters - all of a sudden cannot connect. I get the generic message saying "A network-related or instance-specific ...
Is it possible to save a DataTable into SQL database in one cell of type binary for example and read it back again into a DataTable?
...