Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





UPDATE From A Linked Table


I wanna update the table COMPANY from a linked field. The following is not
accepted. Could anybody help me with what the command should be?
Thanks a lot.


UPDATE `COMPANY`
SET `COMPANY`.Region_ID =
(
SELECT `Area`.Region_ID
FROM `AREA`
WHERE `COMPANY`.Area_ID = `Area`.Area_ID
)




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Can't Update Records When Using Linked Tables In Access
I have a linked table to MySQL 5.0 through MS Access 2003 that utilizes a timestamp field in order to prevent the #Deleted signature happening everytime I create a new record. However, when I attempt to update a previous record I receive the error message: "Reserved error (-7776)" and am subsequently prevented from updating any records. Please note, there are no errors when creating new records, only when I attempt to update an existing one. However, if I remove the timestamp field, updates occur without error. Has anyone else encountered this issue? How might I rectify it?

View Replies !   View Related
Error Accessing MS Access Table Linked To MySQL
I create the linked tables without any problems, clicking on "save password"
before selecting the desired tables. I can then access both tables fine from
within the Access GUI.

The problem starts when I then try to access this data from my ASP.NET web
application - classic ASP works fine but .NET gives me...

ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] ODBC--connection to
'MyDSN' failed.

From then on, the Access database remains locked (.LDB file in the same
directory) and I get a similar error when I run my ASP page, which
previously worked. Code:

View Replies !   View Related
Search Script That Searches "linked" Table
I'm designing an ecommerce store, and I am on to the "search the site" script. I had a simple script set up, but its missing an important part of the search.

The way the (2 relevant) tables are set up are like this:

product_information
Field Type
ID int(10)
product_code varchar(30)
product_summary text
categoryID tinyint(3)

category_lookup
Field Type
ID tinyint(3)
category varchar(25)
parent tinyint(3)
product_code is the product's unique number, category ID refers to the ID of the category that product belongs to (socks, shoes, etc. etc.), and `categoryID` is equal to the category_lookup field `ID`.

What I would like to be able to do is if someone searches socks, any product that has 'socks' in the product_summary or the category it belongs to would be returned. Is this going to be too taxing on the server? I'm new to doing queries at this level so I can't put the query in to the proper syntax. Is there a way to do this all in one efficient query? Or since I'd have to do a lookup for each product in the database, would it be better to first check to see if any of the keywords are in the category_lookup table, and return the ID's if they are. Then I can include just those ID's in the where clause?

View Replies !   View Related
Linked DB
Is it possible to link databases within mysql? I have a access =
database that I need to import into mysql this db consists of 4 other =
dbs linked together sharing a common switchboard. Can I link the tables =
in one db to tables in another db?

View Replies !   View Related
INSERT Into New Table, SELECT From Old Table, UPDATE Old Table With New Key
Code:

INSERT INTO retailers
(retailername, retailerdesc, retailerwebsite, retailerurl, active)
SELECT
datasource_retailername,
datasource_retailerdesc,
datasource_retailerwebsite,
datasource_retailertrackurl,
1
FROM
datasources_retailers_idx AS i
LEFT OUTER JOIN
retailers AS r
ON
r.retailername NOT REGEXP REPLACE(i.datasource_retailername, ' ','.+')

UPDATE datasources_retailers_idx SET idretailers=last_insert_id();

Here's what I'm trying to do:

* Select from old table
* check if there is a matching retailer in the new table
* If not, insert retailers details into new table
* Update a reference column in the old table with the INSERTID primary key value of that row from the new table

View Replies !   View Related
Linked Tables
i am searching a table of addresses, and linked to each of these address are the occupants. this link is done via a link table...

address
occupant
cli2occ - the link table (c2o_id, c2o_address,c2o_occupant)

i can query the database and display a list of addresses and their occupants, but when there are more than one occupant specified in the link table, i get the address appearing twice. what i would like to achive is showing the address once, with all linked occupants in a single row of my search results.

i hope my explanation makes sense, and that someone might be able to point me in the right direction.

View Replies !   View Related
Check If Linked
I am trying to return all columns from table1 plus another column with values of true/false (or 1/0, etc) whether it is linked to table2.

For instance, the following table1 and table1x2: ....

View Replies !   View Related
Linked Server
Is there anything similar to Linked Server of Sql Server / Ms Access in MySql?

View Replies !   View Related
Records From Linked Tables
can anyone help me with an sql statement that will work for mysql to take data from two tables where the two tables are linked with a common field.

View Replies !   View Related
ABSENCE Of A Linked Record
Let's say I have two related tables, a and b, and b is linked to a with a field called a_id. I want to find all the records in a for which there is no related record in b.

View Replies !   View Related
Copying Linked Records
I have a master database setup that contains a user list and an evaluation list where each evaluation is linked to a user. Now, I have a couple of sales guys that are going to be out in the field gathering new users and evaluations with their own copy of this database (most places they'll be won't have an inet connection) and I'm planning to copy over their new info to the master when they return to the office.
My question is whether anyone here has had to do this before. Since this will have to be done frequently, I'm looking to write some code that will speedy up the coping process without breaking any links between the 2 tables (more tables to come in the future) By this I just mean if someone has a quick way for me to add the users and then match up records from the evaluation table to the new user IDs.Breaking these links appears to be my largest issue currently.

View Replies !   View Related
Redundant Linked Records
I'm looking for a way to delete a row if there are no records found linked to the row in another table, for instance this type of logic:

DELETE FROM t1 USING t2 WHERE t1.id not present in t2

View Replies !   View Related
Populate Linked Tables
I have a single web form which creates a record in TABLE A. Within the same form I wish to link this new record to an existing record in TABLE B. Because this relationship is likely to be MANY TO MANY, I have created a linking TABLE C to hold the keys from TABLE and TABLE B.
My question is, how do I insert the new rows to TABLE A and TABLE C at with a single form submit when TABLE C requires the primary key from TABLE A?

View Replies !   View Related
Paginate Linked Rows
I have a DB:
Code:

DROP TABLE `quotes`;
CREATE TABLE `quotes` (
id MEDIUMINT NOT NULL AUTO_INCREMENT PRIMARY KEY,
`quote` VARCHAR(200) NOT NULL default '0',
`ip` VARCHAR(200) NOT NULL default '0'
);

I want to paginate the rows on web pages with a previous and next button.
I am at a page where the 'id' is 5. I have deleted rows in the DB such as row where the 'id' is 4. I can't paginate by saying the previous is 5 - 1 and then next is 5 + 1 because row 4 or row 6 could have been deleted.
How can get the window around row 5, I mean the row before 5 and the row after 5. I want the DB to be like a linked list. It was until I started deleting the auto_increment columnt 'id'.

View Replies !   View Related
Linked List Style
I have a table where records are stored like this:

ID - record Name - Type - replacedBy

I am trying to design a query that will get get all records WHERE ID='10' plus the record that replaces it, plus the one that replaces that one, and so on.

I suspect I'll need a subquery for this but I'm not really sure how that works. Suggestions?

View Replies !   View Related
Showing Linked Data
I've linked tables with Foreign keys using InnoDB tables... So now my question changes.

I'm using the Admin program, by the way. I'm doing this on godaddy.com.

So now I have to ask - is there some way like in Access, so have a linked column show information from another table so that I can pick that instead?

For instance - in access, once I've linked to tables - I can have it show me data from another column, so that I don't have to remember numbers, and can choose names.

For instance - I have 500 fighters. That's a lot... Now every time there's a fight, I have to enter new fight information in a fights table. Now I've linked the FightersInfo.ID column with the Fights.Winner and Fights.Loser column so that it has to point to a specific fighterID number.

HOWEVER - when I go to enter the info, I have to go back and search the list every time to find the two ID numbers for the fighters. This gets to be rather tedious (because I'm just building this DB from scratch).

Is there a way to have the input box actually show the names of the fighters, so that I can type their name instead, like in Access? In Access I can make it so that it shows the information from a specific Column (like Name) and then I can choose it by that, but it will actually input the fighterID number instead.

If not - should I remove Fighters.ID as the PK and use the Fighter's First and Last Name as their Primary Keys?

This way I have to type out the full name every time, but it's a lot easier than having to find a fighterID number over and over and over again.

Or is it bad for to not have an ID number as the PK? There aren't many fighters with the same name, so I could pull an IMDB.com and just have the second or third ones with (II) and (III) after their names.

View Replies !   View Related
Delete From Linked Tables
Is it possble to delete all records from a table and all records in a second table that are linked to that record?

View Replies !   View Related
ODBC :: Insert On A Linked Field
i have installed Easyphp 1.8 on my PC and set up a mysql database on it...it works perfectly,i have also installed MYODBC and again i have linked this up to the tables in MYSQL - Perfectly.I have created a form for data entry in MS Access 2000 and all is linked up ok, showing current recordsstored in the mysql table

PROBLEM!!!

the problem is that when i try to add records the form i get the following message:

ODBC - insert on a linked field 'plmatchdata' failed
[microsoft][ODBC Driver Manager] SQL data type out of range(#0)


View Replies !   View Related
Simulating Access Linked Tables
I am currently converting access databases to mysql databases, and I've come across a problem that I haven't been able to find an answer to. Example of my dilemma:

db1.mdb
table_1_db1
table_2_db1
table_3_db1
table_4_db1
table_3_db2 (linked table from db2.mdb)

db2.mdb
table_1_db2
table_2_db2
table_3_db2
table_4_db2

It is then possible to query db1.mdb -> table_3_db2 as if db1.mdb owns table_3_db2.

Is there a way to simulate this in a mysql database so that there is not much heavy modification of the code/SQL that draws out the data?
for example this would be one of my sql statements drawing data from access:
connected to db1.mdb
"select 32.name, 31.age from table_3_db2 32, table_3_db1 31"

I want to be able to do the same thing with mysql but without having to access db1 and db2 then drawing them out seperatly, meaning once again, not much heavy modification to the sql.

View Replies !   View Related
Tables In MySQL Linked To Access97
We are running a front end using microsoft access 97. We have a mysql database (v4.1.5) and we link all the tables in that database to the access database via the ODBC driver version 3.51.

We have one table that has one field. The create statement is below.

DROP TABLE IF EXISTS `tbltlacceptable`;
CREATE TABLE `tbltlacceptable` (
`TLAccepted` double NOT NULL default '0',
PRIMARY KEY (`TLAccepted`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

And a very simple insert statement that inserts 4 values.

INSERT INTO `tbltlacceptable` (`TLAccepted`) VALUES (110),(120),(137.5),(480);

Now, the problem is that when viewing this table in access, the value that is 110 shows up as #DELETED. All the rest are visible. If you then insert the value 109 is also shows up as #DELETED, but 108 all the way down to 0 shows up normally. Moving up the scale, 111 to 119 shows up as #DELETED but 120 and up show up normally.

I've tried duplicating this in a table in Sybase, the same problem does not occur. So I'm assuming that it has something to do with the driver, but I'm not sure.

View Replies !   View Related
Query Command For Linked List
I am working on a data base and using mysql. The following three tables are being used and want find the Name of the Domain from the Domain List which are equivalent. Like to inform you that a linked list conception is being used in the Table DomainEquivalentList. Could you please give some clue for the query command....

View Replies !   View Related
NOT EXISTS.... Problem With Tables Linked
I'm creating a solution where I want to be able to control which users can use each page.
This is how database is designed (in short).
PHP
pages
id | page_title
users
id | username
pages2users
page_id | user_id
Now I want to display which pages a certain user can NOT use.
I've tried this query but it does not work.
PHP
$user_id = addslashes($_GET['user_id']);
sql = "
SELECT * FROM pages p
WHERE NOT EXISTS ( SELECT p2u.* FROM pages2users p2u WHERE p2u.user_id = '$user_id' )
ORDER BY p.page_title
";
$result = $db->query($sql);
while ($row = $result->fetch()) {
echo $row['page_title'].'<br/>'
}
But that gives me nothing... How do I fix this?

View Replies !   View Related
Update Table Based On Email In Another Table
I'm having trouble updating the entries from a table. The situation is as follows:

Customer table contains:
1) customer_email_address
2) customer_newsletter (value 0 or 1)

Visitor table contains:
1) email

The visitor table contains email addresses from customers that have signed up through another system.

I would like to update the customer table and set customer_newsletter to 1 where customer_email_address matches email from the visitor table.

View Replies !   View Related
Access Linked Tables Show #Deleted
What can I do about my Access Linked ODBC tables showing the #Deleted
error?

I am using MySQL ODBC 3.51 Driver and Access 2000. I can create linked tables to the MySQL database running remotely on a Linux
box.

Unfortunately, when you open the table (in Access), all the data are filled
with [#Deleted] error values.

This one is driving me crazy because I can successfully read and write to
this database ODBC<->DAO or ODBC<->ADO. So the ODBC configuration has to be
substatntially correct - right?

So how do I get Access to display the data properly?

View Replies !   View Related
Retrieve Multiple Linked Records Efficiently
I have some records in database related to supply chain.
e.g. N1 supplies item I1 to Node N2 is represented as N1 I1 N2.
Now I want to find all parent nodes or say chain of nodes supplying to particular node in an efficient way.

Can you please tell me how I can do it with efficient query. Currently it needs multiple queries & performance drops considerably.

View Replies !   View Related
Microsoft Access / MySQL Linked Tables
I've got a UTF-8 database table with Japanese text in. I thought I'd start a new post as its a seperate issue to my previous one.
I'm trying to set up MS Access using linked tables to access the data. I'm using the MySQL Connector/ODBC 3.51 driver.
Trouble is its displaying the data as ??? ??? ??? like this. I need to somehow find a way of making the odbc connection or access into UTF-8.

Also, the other client I'm using ( Aqua Data Studio ) displays the text incorrectly. I know the data is ok in the actual table as if I retrieve it it displays on my web page ok.
EDIT: It displays FINE in MySQL Query Browser, part of MySQLAdmin. This proves its the client.

View Replies !   View Related
Using A Left Join With 2 Values Linked To The Same Tables
I have a table that has two values, author_id and approver_id. Both of these refer to the value id in my users table.
Is it possible to use a left join and have the query get the author and approver name (also in the users table)? Or will I have to use multiple queries? (Can't use nested selects, this particular server is still running MySQL3 -sigh-).



View Replies !   View Related
Update Table With Info In Other Table
i have a case like this:

table table1 (key, accumulator)

table table2 (key, counter)

i want to, for each table1.key = table2.key, update accumulator with the info in counter, something like this:

update table1 set accumulator=accumulator+table2.counter where (? counter is the value related with the same key as the one in table1)

how do you write a sentence like this one?

View Replies !   View Related
Update A Table With Data From Another Table
I have two tables with similar data. The firs table contains data that is to be updated with data from the second table. The first table (tblA) has a unique key, but the second table (tblB) does not.

I have to use the 'lastname', 'firstname' and 'dept' fields that are in both tables and join the tables on those three fields.

I have tried:

update tblA, tblB
set tblA.empPty=tblB.empPty
where ((tblA.empLName=tblB.empLName)
and (tblA.empFName=tblB.empFName)
and (tblA.empDept=tblB.empDept));

with some test data where I know I have a match using the three fields, but nothing gets updated.

View Replies !   View Related
Update One Table Value With Values From Another Table
I am trying to update one table value with values from another table, and I cannot get it to work. What am I doing wrong?

This is my SQL-command:
UPDATE tabel1 SET tabel1.name=tabel2.name WHERE tabel1.ID=tabel2.ID

View Replies !   View Related
Update Table With API
I'm trying to develope a getway between matlab and mysql. I would like to
write the result of matlab routine into mysql table without "UPDATE
.....SET..." statement, because I've have to write a different value for each
row and I have to write a lot of row. I would like to write table row by row
sequentially.



View Replies !   View Related
2-table UPDATE
I am running the following query through PHP's mysql_query:

UPDATE hotel, hotel_brand
SET hotel.hotel_brand_id=0, hotel_brand.hotel_brand_parent_id=0
WHERE hotel.hotel_brand_id=6 AND hotel_brand.hotel_brand_parent_id=6

In actuality, it's two queries combined into 1. I am deleting a value that rows in these 2 tables reference, and want to set the values to 0.
Of course, the problem is the values aren't changing to 0.

Is splitting these up the best solution?

View Replies !   View Related
Update Table From TXT/CSV
I have a table With Field1(INT,8,PK), Field2(INT,6,PK), Field3(VARCHAR,255) and Field4(VARCHAR,255).

I have to update records from a FIXED LENGTH TXT that contains:
Field1(8 digits)Field2(8 digits)Field4(1-255 digits) or the same in CSV....

View Replies !   View Related
UPDATE Table SET
Does anyone know how to implement this into a php form CORRECTLY? I have all the proper syntax but then the server gives me a message that says the mysql version may not go along with the syntax. How do I work around this then? I need to update query strings and such and nothing will work.

View Replies !   View Related
UPDATE From One Table To Another
This should be so simple but I'm getting a very strange error??

I'm using MySQL version: 4.1.12-log

I've got an outdated country table that I'd like to update info from an ISO table. Pretty straight forward if you ask me.

Here's the query:
UPDATE country, isocountry SET country.un_numcode=isocountry.numcode
WHERE country.country_code=isocountry.iso;

I created a column called un_numcode and then I'd like to put the iso numcode info in my table where the country_code = iso code (same data, different field names in different tables).

It goes along really well for 38 rows out of 239 rows?? And then I start getting 127 in ALL the un_numcode fields even though that value does NOT exist in the country.numcode table!

View Replies !   View Related
Update One Table
I have 2 tables one for the team standings one for the scores, this select statement will calculate win loss :

SELECT
SUM((homescore>awayscore and home=teamid)
OR (awayscore>homescore and away=teamid)
) as wins,
SUM((homescore>awayscore and away=teamid)
OR (awayscore>homescore and home=teamid)
) as losses
FROM scores, teams
order by teamID

View Replies !   View Related
Table Update
How do I relate such a way that I update a column of the main table, another secondary table's column related to the main table gets updated automatically?

View Replies !   View Related
Update A Table With Values In Another
I have the following table

tableA
column_a
column_x
column_y
column_z

tableB
column_x
column_y
column_z

How do I update the rows of tableA that match rows of tableB (all rows
of tableB are unique)

What I want to acheive is a check against tableA.column_x with
tableB.column_x, if they match, then update the row in tableA.column_y
with the value of tableB.column_y and tableA.column_z with
tableB.column_z

View Replies !   View Related
Update Table By ID Ranges
How do i use the UPDATE statement to update a range of Primary Key id
numbers. (let say 100 through 1000).

Example,

UPDATE testTable set testField='9999' WHERE
test_id in (100:1000);

View Replies !   View Related
UPDATE Based On Value In Another Table
How do I update a table to remove orphaned references to a second table? I've deleted rows in the second table, which has a unique auto_increment key. The first table now has references to keys that no longer exist. I need to update the first table, setting the value to NULL where the referenced key no longer exists. Something like:

UPDATE table1 SET table2ID = NULL WHERE table1.table2ID NOT FOUND IN
table2.ID;

The NOT FOUND IN isn't SQL, of course, but I'm not sure what should go there.

View Replies !   View Related
Automatic Table Update
i have an database in which i need to update a status filed of an table with the date.

i,e those datas which gets expired are to be updated..

so need to run a command in mysql by default.,

View Replies !   View Related
Multiple-table UPDATE.
I'm trying to update multiple-tables at the same time but I read somewhere that you could do it if you had mysql version 4.0.4. But currently, I have version 4.0.0 and I want to know how to do it with this version

View Replies !   View Related
Update Table Problems
I'm trying to update a table where specific values are in another table. Here is the update statement I am using:

UPDATE Route_Detail,Routes SET Route_Detail.Trip_Calc='S'
WHERE Routes.Route_ID = Route_Detail.Route_ID
AND Routes.Project_Code = 'OSUT'
AND DATE_FORMAT( Route_Detail.R_Date, '%m%Y' ) = 072006

This statement runs but does not update any rows.

This select statement returns 11 rows:
SELECT RDetail_ID
FROM Route_Detail
INNER JOIN Routes ON Routes.Route_ID = Route_Detail.Route_ID
WHERE Routes.Project_Code = 'OSUT'
AND DATE_FORMAT( Route_Detail.R_Date, '%m%Y' ) = 072006

How do I get the UPDATE statement to update those 11 rows.

I'm using MySQL 4.1.21-standard version.

View Replies !   View Related
Fields In Table Will Not Always Update,
I'm using C#, ASP.NET and MySQL, The language is no problem (not to much) but the rest well I wonder. I have a DB table that has 5 seperate fields. A main one that
is Integer and the rest are VarChar(50). each of the 4 others are identical in setup. I can change some records and others I can't.

ID int(10),
std varchr(50),
atd varchr(50),
dtd varchr(50),
ctd varchr(50)

I update say 'atd' with new data, Date, Time and a code of 15 letters/numbers.This one takes, I change to another record and try to update ctd and it shows like it takes but when I use the Command Line it shows no updates on ctd. this is random on this also.
If I change to another record it may all work or not. Any Ideas at all?

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved