I am using the following query to insert values into one field in table A.
insert
into A (name)
values ('abc')
where
A.id=B.code
and B.dept='hr' ;
Is this query right?
If not, please provide me a correct way. It's really urgent. Thanks in advance.
...
Is there any way to update a table within the select_expr part of a mysql select query. Here is an example of what I am trying to achieve:
SELECT id, name, (UPDATE tbl2 SET currname = tbl.name WHERE tbl2.id = tbl.id) FROM tbl;
This gives me an error in mysql, but I dont see why this shouldn't be possible as long as I am not changing ...
As part of an ecommerce system I need to design and implement a blackbox of sorts. This needs to accept customers and orders from various internal and external data sources (i.e., web site, extranet, yahoo store, amazon xml feeds, etc.) and insert/update a backend system. The api's to insert/update customer and order data are in place ...
Hi,
I have the following issue.
We have a user table, every user has an unique email and username. We try to do this within our code but we want to be sure users are never inserted (or updated) in the database with the same username of email.
I've added a BEFORE INSERT Trigger which prevents the insertion of duplicate users.
CREATE TRI...
I've got a sql query (using MS-SQL 2005) that generates data with these columns:
TimeStamp | SpeedMax | SpeedMin | HeightMax | HeightMin
-------------------------------------------------------
10 | 50 | 10 | 300 | 70
The form I need it in though is this:
TimeStamp | Speed | Height
---------------------------
...
Query gives Syntax error missing operator in query '[Relationship Manager]=John DOE'
BCA_Source = " SELECT distinct [Account Data Table less DTA CHD].BCA_ICA, " _
& "[Account Data Table less DTA CHD].[Relationship Manager]" _
& " FROM [Account Data Table less DTA CHD] " _
& " WHERE [Relationship Mana...
We currently have a search on our website that allows users to enter a date range. The page calls a stored procedure that queries for the date range and returns the appropriate data. However, a lot of our tables contain 30m to 60m rows. If a user entered a date range of a year (or some large range), the database would grind to a halt....
I have 5 columns corresponding to answers in a trivia game database - right, wrong1, wrong2, wrong3, wrong4
I want to return all possible answers without duplicates. I was hoping to accomplish this without using a temp table. Is it possible to use something similar to this?:
select c1, c2, count(*)
from t
group by c1, c2
But this re...
Hi All,
I have a MySQL indexing question for you guys.
I've got a very large table (~100Million Records) in MySQL that contains information about files. Most of the Queries I do on it involve substring operations on the file path column.
Here's the table ddl:
CREATE TABLE `filesystem_data`.`$tablename` (
`file_id` INT( 14 ) NOT...
For some reason, my SQL installation isn't working :)
SELECT DATEADD(s,1234567890, '19700101')
Maybe this site would help (link from Moose).
...
The table Arc(x,y) currently has the
following tuples (note there are
duplicates):
(1,2),
(1,2),
(2,3),
(3,4),
(3,4),
(4,1),
(4,1),
(4,1),
(4,2)
Compute the result of the query:
SELECT a1.x, a2.y, COUNT(*)
FROM Arc a1, Arc a2
WHERE a1.y = a2.x
GROUP BY a1.x, a2.y;
What are a1 and a2 referring to?
...
Any recommends here? I need something that can take a set of processes and batch them together. For example, I need to:
1) execute some sql
2) run C# snippets
3) have checkpoint steps with human interaction (i.e. send off an email at step X and wait for a user to review a result and click continue etc...)
...
BACKGROUND:I am running MS2005. I have a MASTER table (ID, MDESC) and a DETAIL table (MID, DID, DDESC) with data as follows
1 MASTER_1
2 MASTER_2
1 L1 DETAIL_M1_L1
1 L2 DETAIL_M1_L2
1 L3 DETAIL_M1_L3
2 L1 DETAIL_M2_L1
2 L2 DETAIL_M2_L2
If I join the tables with
SELECT M.*, D.DID FROM MASTER M INNER JOIN DETAIL D on M.ID = D.MID
I...
Hi there.
Using SQL Server 2005 I have a field that contains a datetime value.
What I am trying to do is create 2 queries:
Compare to see if stored datetime is of the same month+year as current date
Compare to see if stored datetime is of the same year as current date
There is probably a simple solution but I keep hitting brick wal...
I want to rewrite this query so that if @UserName gets passed in a null value then it leaves the Client_User out of the search criteria. I only want it to search by name if the user enters a name in the username textbox on the webform. I'm not sure how to do this.
select * from weblogs.dbo.vwlogs
where Log_time between @BeginDate and...
I am trying to replace multiple rows in an Access database to follow a new set of data rules. For instance, the word Fort in Fort Myers is listed as Ft., Ft and Fort. I would like to make a global change to the group. I am familiar with the SQL replace command, but wondering if anyone has done something similar with a stored procedure...
What is the best way to do this in Access?
Create table tmp
(
plant int,
material vchar(20),
workcenter int,
setuptime vchar(20)
)
insert into tmp values( 1, mat1, 2, 30)
insert into tmp values( 1, mat1, 3, 30)
insert into tmp values( 1, mat2, 3, 30)
insert into tmp values( 1, mat2, 4, 30)
insert into tmp values( 2, mat1, 4, 30...
Hi folks,
I've got a game which dumps state information to a database. Eg. Connected, Lost Connection, Grabbed Screen Dump, etc.
Each state is defined by a field called StateTypeId, which is a foreign key to a simple lookup table 'StateTypes'.
Now, i'm trying to find all the people who are currently 'Connected' (eg. StateTypeId == 1),...
I have a temp table that needs the values of a Stored procedure. So the SP inserts 3 columns into the temp table, then I want to add a datetime to every row without modifying the SP.
Since I call 3 times the SP each with a different datetime, I can't just update the whole temp table.
Any Suggestions?
DECLARE @temp TABLE
(
...
Hello All,
I'm currently trying to write a website for testing / learning purposes that will wrap around the IMDB datasets that are dumped.
I'm having trouble determining the best way to extract the data into a format that is easier to manage. I will need to pull data from several files:
movies.list = Movie list of all movies and yea...