Dear All ...
This is probably a very stupid question for SQL stalwarts, but I just want one SQL command.
Details,
I am using a data analysis tool called R, this tool uses ODBC to read data from XLS. I am now trying to read data from an XLS file. The ODBC tool in R accepts SQL commands.
Question,
Can someone give me an SQL command th...
My requirement is to update the description field in table 1 with the description of the table 2 and 3 by concatinating. I'll give you the structure below.
table1 --P A D table2 --- P D table3 --- A D
table D with concatinating The table2 D and table3 D
...
I have two lists of ids. List A and List B. Both of these lists are actually the results of SQL queries (QUERY A and QUERY B respectively).
I want to 'filter' List A, by removing the ids in List A if they appear in list B.
So for example if list A looks like this:
1, 2, 3, 4, 7
and List B looks like this:
2,7
then the 'filtered' Li...
Hi,
We use an online project management system, and I'm trying to extend it somewhat.
It has the following tables of interest:
todo_itemStatus:
+--------------+-----------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---...
Hi,
I have 2 MYSQL tables viz. main_table and query1. main_table contains the columns position and chr whilst query1 contains position, chr and symbol. The table query1 is derived by querying the main_table. I am wanting to match up both these tables using Perl such that the output would have the entire list of positions from the main_t...
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER VIEW [dbo].[viewProductExportUpdated2]
AS
SELECT dbo.ProductCategories.ProductCategoryID AS ProductCode, dbo.ProductCategories.ProductCategoryName AS ProductTitle,
dbo.Products.ShortDescription AS ProductShortDesc, dbo.Products.LongDescription AS ProductLo...
I'm trying to count the number of rows that have distinct values in both of the columns "a" and "b" in my Sybase ISQL 9 database.
What I means is, the following dataset will produce the answer "4":
a b
1 9
2 9
3 8
3 7
2 9
3 7
Something like the following syntax would be nice:
SELECT COUNT(DISTINCT a, b) FROM MyTable
But this doesn...
I want to provide the table name for a query as command parameters, like so:
public class Foo
{
private const String myTableName = "mytable";
public void Bar()
{
NpgsqlCommand command = new NpgsqlCommand("SELECT * from :tableName", connection);
command.Parameters.Add(new NpgsqlParameter("tableName", DbType.S...
I have a table of data, that looks something like this:
ID CODE
1 FOO
1 FOO2
1 FOO3
1 BADCODE
2 FOO
2 FOO2
When I perform a query on this table I essentially want to discount all rows that contain the same ID if a bad code is found. So in the example above nothing with an ID of 1 would ...
Hi, I'm trying to create a simple poll function using php and sql.
I have three tables:
Questions
Which simply contains each question asked
question_id | question_text | created_at
Answers
Which contains each answer for each question
question_id | answer_id | answer_text
Answered Questions
Which records who has voted for each opt...
Hi,
I'm doing a quote creator tool. There is a table that will store all the customer info. Then there is a quote table which will share the customer_id key and store all details of the quote.
I would like to store all details of the products quoted in the quote table. Now with a shopping cart you would have a products table with all t...
I want to insert n records into a single table. There may be many concurrent users and they may insert/update/select data from this table. What is better way to insert in a such table say 1000 records:
Send a single sql query to a database with multiple inserts. This saves server to database calls, but (I not sure) locks the table unti...
What I mean is, If I had the following schema:
create table tableA(
A_id number not null primary key
);
create table tableB(
B_id number not null primary key,
A_id number not null references tableA(A_id),
B_data text not null
);
create table tableC(
C_id number not null primary key,
A_id number not ...
Following on from one of the answers in this thread;
http://stackoverflow.com/questions/214060/using-xquery-in-linq-to-sql/214435#214435
I'm trying to create a sql table function that will take parameters in order to perform queries on xml data. The function can then be consumed by a linq query.
Issue's i'm having are ;
If i take th...
SELECT (b.descr || ' - ' || c.descr) description
FROM tbl1 a LEFT JOIN tbl2 b ON a.ACCOUNT = b.ACCOUNT
LEFT JOIN tbl3 c ON a.product = c.product
WHERE a.descr50 = ' ' ;
table1 has only 7622 rows with descr50 = ' ' but this select is returning 7649 rows. Could you please help me in this? thanks in advance
...
My app has an advanced feature that accepts SQL queries written by the user. The feature should include a "Validate" button to check if the query is valid.
The most simple way I found to do this using ADO is just trying to run the query and catch possible exceptions. But how can I also check if the query enables to add new records or to...
I have a product table that contains thousands of products. Some products are available in different colors. But when somebody searches for example 'mp3 player' i dont want to show him every color, instead just the player with the best selling color.
Her is the table layout (simplified):
ID | PRODUCT_NAME | COLOR | SALE_COUNT
====...
This question is based on this answer.
What does the following sentence mean?
Finally, don't use mixed case
identifiers. Do everything lowercase,
so you don't have to quote them.
Does it mean that I should change the commands such as CREATE TABLE, USER_ID and NOT NULL to lowercase? - It cannot because it would be against commo...
I am using the following MySQL query in a PHP script on a database that contains over 300,000,000 (yes, three hundred million) rows. I know that it is extremely resource intensive and it takes ages to run this one query. Does anyone know how I can either optimise the query or get the information in another way that's quicker?
I need to ...
I am doing my first database project.
I would like to know how you can have false as the default value for the following SQL -query
...
MODERATOR_REMOVAL boolean NOT NULL
...
Context
CREATE TABLE Questions
(
USER_ID integer FOREIGN KEY
REFERENCES User_info(USER_ID)
PRIMARY KEY
...