sql

hyperlink data not transferring to destination table

I'm inserting records that includes a hyperlink field from 1 table into another that include a hyperlink field of the same name. In the source table, the hyperlink behaves correctly; however, when inserted into the destination table, it does not. The field displays the correct "hyperlink" (path) in the destination; however, it is not fun...

Problems with SQL Inner join

Hi all, Having some problems while trying to optimize my SQL. I got 2 tables like this: Names id, analyseid, name Analyses id, date, analyseid. I want to get the newest analyse from Analyses (ordered by date) for every name (they are unique) in Names. I can't really see how to do this without using 2 x nested selects. My try (Dont...

Stored Procedures programmed to fire in separate serial transactions appear to execute simultaneously

I have a .net application that has to execute a series of steps in a job. Each step lives in its own transaction, and all tasks are executed serially (no explicit async). The last two tasks are a data transform, and a data retrieval of the transformed data. We are getting deadlock errors from these last two steps, because the last step l...

A simple sql query question.

suppose I have a table like this: table1: name favorite_music a country b rock a jazz b jazz How can I do this query: find the names whose favorite_music style has both "country" and "jazz". For the example above, it should be only "a". ...

introduction to triggers in sql server

if you create a new trigger in sql server, it gives you this template: --==================================== -- Create database trigger template --==================================== USE <database_name, sysname, AdventureWorks> GO IF EXISTS( SELECT * FROM sys.triggers WHERE name = N'<trigger_name, sysname, table_alter_drop...

SQL Query - Understanding the Syntax

I want to display greatest selling product by quantity Product Table ProductID ProductName 1 AA 2 BB 3 CC [Order Details] Table OrderID ProductID Quantity DateOfOrder 1 1 10 SomeDate 2 1 100 ,, 3 2 15 ,, 4 1 15 ,, ...

Problem with query

I've four tables: characters guid name gender class race online character_arena_stats guid personal_rating matchmaker_rating arena_team_member arenateamid played_season played_week wons_season wons_week arena_team arenateamid captain_guid and I need to get character details(race,class,name,gender,online) and team information(...

ms-access: is it possible to save an access form separately from DB?

i have a front end access with a bunch of forms and reports. i want to be able to save one of the forms by itself to its own file. how do i do it? ...

Locating all reachable nodes using SQL

Suppose a table with two columns: From and To. Example: From To 1 2 2 3 2 4 4 5 I would like to know the most effective way to locate all nodes that are reachable from a node using a SQL Query. Example: given 1 it would return 2,3,4 and 5. It is possible to use several queries united by UNION clauses but it would limit the...

Document Control

What is the best open source document control app for PHP/MySQL? Focus is to be on a system that is robust, easy to use and fast to implement. Needs to have security layers so that files can be public or private. Group assets would be nice. Project management features would be a bonus if they were scalable, robust but not overcomplicate...

Comparing a possibly empty string in C#

Hi all, I'm trying to compare a string field from a LINQ query on a database using: e.Comment.equals("Working From Home") on the WHERE clause. However, sometimes the Comment field could be empty which currently causes an Object reference not set to an instance of an object exception. Is there any way I can check if the Comment isn...

SQL Server 2008 FullText Search Query

Hello, I have added Full Text Search to my sql server 2008 express database and created an index catalog for two columns in a single table. So now, I have to rewrite one of my stored procedures but I have no idea where to begin. The following is my current SP that I need to convert to take advantage of the full text search capability: A...

How to enforce proper subset selection in a list?

As an example: Say there are two tables: Person, and Photo. Each Photo has a PersonId column to indicate who it is a picture of, and each Person can have many Photos. Each Person has a single Photo of themself selected. In this situation, how can the CurrentlySelected Photo be stored in a relational, denormalized way that ensures the ...

Removing records with the same ID in selected dataset (ADS)

I'm trying to query a clinic practice management database to return a dataset that matches any in a list of values (icd-9 codes) for four different fields, but then only return the id number for the patient, or only the first record for that patient which has one of the icd-9 codes. Then, I plan to finagle some sub report to give me the...

Two or more similar counts on fact table in dimensional modelling

I have designed a fact table that stores the facts for a specific date dimension and an action type such as create, update or cancelled. The facts can be create and cancelled only once, but update many times. myfact --------------- date_key location_key action_type_key This will allow me to get a count for all the updates done, all t...

SQL: How to select the record with the most recent past date for every record on other table.

How can I reformulate this two queries in one single query on MySQL? SELECT * FROM tvnetwork //this query gives me a list of TV networks But networks usually change names and logos, so for each of the retrieved TV networks: SELECT name, logo FROM tvnetworkinfo WHERE id = $tvnetwork.id AND date_since < NOW() ORDER BY date_...

Finding Alternative Accounts, SQL

I have a setup like this: Username | IP Foo | 1.2.3.4 Bar | 1.2.3.4 Baz | 1.2.3.6 Say I want to find alternative accounts of the user "Foo". Something like this should return: Username | IP Bar | 1.2.3.4 How would I do such a thing in one SQL query? ...

How did SQL become the dominant database language?

For most programming tasks, you've got quite the selection of languages to choose from, and good strong communities behind plenty of them. But when you need to work with a database, there's really only one viable choice these days: SQL. Sure, there are different companies with different implementations and dialects, but you're still lo...

Does a FULLTEXT index speed up LIKE conditions?

We have a system that is migrating from an older VARCHAR using LIKE setup to one that uses FULLTEXT indexes. So far everyone is enjoying the switch, but we still have some code that isn't catered to the FULLTEXT queries. Currently we have a column that is a VARCHAR(255) and we want to remove the 255 character limit. What will happen to ...

Avoiding SQL Not IN by using Replace and Length check

I have a situation where I have to dynamically create my SQL strings and I'm trying to use paramaters and sp_executesql where possible so I can reuse query plans. In doing lots of reading online and personal experience I have found "NOT IN"s and "INNER/LEFT JOIN"s to be slow performers and expensive when the base (left-most) table is lar...