Inserting Data With A Partial List.
If I have an auto increment field in a table and I were to insert data into other rows that were in the table but left the auto incremented one out of the list of columns to insert would it cause an error?
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Loading Database From Multiple Text Files Each Containing A Partial List Of Columns
I'm kind of new to mysql. I would like to know if there is a way to use load infile or mysql import syntax to load one table with multiple files each containing a partial list of the table's columns: Table contains : ID, first name, last name, occupation, salary There are two files one containing the first three columns, the other the first field (ID) and last two fields. Is there a way to load them with just two load statements? Note: I know that they can be loaded into two tables and later joined where ID is equal, but the actual example is about 30 text files rather than two, which is a bit too much.
View Replies !
View Related
Inserting A List Of Names
I have the following: INSERT IGNORE INTO names (name) VALUES ('John'),('Peter'); In the above query, I want to pass an unknown amount of names to the insert query. I tried a stored procedure with the following: INSERT IGNORE INTO names (name) VALUES (paramList); where paramList I set it as LongText, and passed paramList = ('John'),('Peter'); but it didn't work. Is there a solution to insert a number of names for example by using a stored procedure in MySql 5.0.
View Replies !
View Related
Extract Partial Data
On my site I display a list of 10 articles on a page. I show 10 titles plus the first 250 characters of each article. At the moment with my MySQL statement I bring all the data from the database and parse it with PHP to show the partial content text. This seems very slow to me especially if the articles are big. If I truncate the data I bring from the database will that be a faster way to bring across the data? What would be the best way to do this? So far I've tried..Code: SELECT id,title,SUBSTRING(article, 0, 250) as article,showdate from articles ORDER BY showdate DESC Limit 0,10 But that doesnt bring anything across, 'article' seems to be empty.
View Replies !
View Related
Partial Data For Replication.
I have setup MySQL cluster with MySQL 5.1.20. along with this setup I have a replicated server which just accepts updated from one of the many databases associated with the cluster. As part of my configuration, I have setup the binlog on the master and used the mysqldump backup method & SLAVE START for the initial slave sync. I have confirmed the ability to add new records on the master node and the correct data appears on the slave. The one issue I have been having is updating. Whenever I update and only SET certain column values, all other values are NULLified.
View Replies !
View Related
Inserting New Data
I have a form that has name, address, city, state, zip. All this goes into a single table. I want to add an additional table to put the cities into. I want to pull the cities from the city tables into a dynamic dropdown to choose the cities from.My problem is if I have a city already in the city table, I dont want to add it again and have duplicate citys in the dropdown. Anyone have a clues on how I would do this?
View Replies !
View Related
Inserting Data Into Two Tables
if I want to insert data into two tables how do I do this? Is this right? I'm guessing not as it doesn't work What should I do? $query = "insert into requests (word,status) values ("$req","pending") AND insert into known_by (word,user_name) values ("$req","$user_name")";
View Replies !
View Related
Problem In Inserting Data
I have a table with 8 fields ,,in which one PK and two indices ,, now I want to insert a new data , and to avoid dublication I want to check the two indices together IF they are equal to the similar fields in the coming data , I want to remove the existed or update it completely (changing all the fields) , so I tried using INSERT.....ON DUBLICATE UPDATE .. it will check only the PK or one index then give you the chance to update one field ..(that what I understood about it). another way is , using REPLACE , but also it only checks the PK ... I dont want to check the PK.. it is only (AI) auto increment number HOw to do it saying like this : INSERT INTO mytable (A,B,C,D) VALUES (A1,B1,C1,D1) and IF the stored A == the coming A AND the stored C==the coming C THEN delete the existed or dont insert this row
View Replies !
View Related
Inserting Data Into Table
My task is to create a table which works as a "linker" of two other tables. In this linker table as foreign keys I am using keys from this two tables. I am inserting data into first table t1 in one loop in Perl script, then in a second loop I am inserting data into table t2 and immediately after into t3 which is a linker table between t1 and t2. I have no problems with id (primary key) from t2 , but while extracting keys from t1 there is message: Subquery returns more than 1 row after subquery: insert into t3 (t1id,t2id) values ((select id from t1 where name like 'x'),(select max(t2id) from t2)); simply because value '' are present in table t1 two times so it has two keys. How this problems can be solved? I tried to use: insert into t3 (t1id,t2id) values ((select id from t1 where name like 'x'=ANY(select id from t1 where name like 'x')),(select max(t2id) from t2)); however then there was a message:ERROR 1048 (23000): Column 'id' cannot be null because it is t1 primary key? Are there any ways of dealing with this problem?
View Replies !
View Related
Inserting Dynamic Data?
In the connectorJ example: stmt.executeUpdate( "INSERT INTO autoIncTutorial (dataField) " + "values ('Can I Get the Auto Increment Field?')", Statement.RETURN_GENERATED_KEYS); it works perfectly fine for static text. I can't seem to figure out a way to get it to accept dynamic data (from java beans etc) i.e. mybean.getA(), myBean.getDate for example: "values ('Can I Get the Auto Increment Field?'" + getA() ) gives me a compilation error. What's the proper syntax?
View Replies !
View Related
Inserting VB Data Into MySQL Using Ado
I am trying to insert some data into a MySQL db, with Visual Basic by using ADO. I can select data without a problem using adorecordset.open, to insert would I use adorecordset.addnew? if anybody has done this and has a sample script I would be very happy to check it out.
View Replies !
View Related
Trouble With Id + 1 When Inserting Data
I'm trying to find a good alternative for auto_increment, the reason is that I need to know what the next value of id will be before inserting data into the table and I haven't found a relyable way of doing that with auto_increment. My plan was to use a commend like: INSERT INTO temp (id, test) VALUES (MAX(id)+1, 'foo') But I am getting the error: ERROR 1111 (HY000): Invalid use of group function.
View Replies !
View Related
Problem Inserting Data
I'm having an issue inserting data into a MySQL database using PHP code which has worked before. Some of the fields in the form have been removed and so are not passing data across to the insert script and the insert has been altered to show this, apart from that everything is the same. Could anyone help me diagnose what is going on this code to not make it work, I've been looking for the last 2 hours and just cannot find the problem. Data entry page PHP <? if(isset($_GET[submit])){ $error='' if ($_GET['heightcm']=='') { $height=($_GET['heightinches']*2.54); } else { $height=$_GET['heightcm']; } if ($_GET['widthcm']=='') { $width=($_GET['widthinches']*2.54); } else { $width=$_GET['widthcm']; } if ($_GET['depthcm']=='') { $depth=($_GET['depthinches']*2.54); } else { $d
View Replies !
View Related
Storing List Data
How would a set of related values be stored together in a MySQL db? For example, if I wanted to store a user's buddy list, then the way I can think of would be something like this: user | friend John | Jim John | Bob John | Amy Bob | Jim Bob | Amy So John's friendlist would include Jim, Bob, and Amy, and Bob's friendlist would include Jim and Amy. But it seems really inefficient to create a new row every time a new entry in the list is needed I want to be able to store values like this: user | buddylist John | Jim,Bob,Amy Bob | Jim,Amy What would be the most efficient way to do this?
View Replies !
View Related
Inserting Unicode Data In Forms6i
i m using forms 6i with oracle 10g. i have set Nls_lang =American_America.UTF8. Now my problem is when i type some data i marathi Using a font converter engine directly into the text box on form i just get ?in the text box. when i type same data on notepad n then paste it in textbox it gets properly pasted and also get inserted in oracle.I m also able to retrive it back properly.So i think it is not the problem of my character set.Also i have set the font of textbox as Arial Unicode Ms. i m not getting where the problem is?
View Replies !
View Related
Inserting Data Into Mysql Database
i need to insert data from a txt file that is updating continously, select those info that i need by line, and after that adding them, i don't think that can be done in mysql; i've foud another program that i've made to read the file and select them, but now i don't know how to insert them in a data base, except php is there another program that can insert data into a mysql database?
View Replies !
View Related
Php Mysql Not Inserting Data, No Rerror Msg.
On development machine is a winXP and server for test is linux RHEL. I have a code that gets data from a form and insert into a table. -- $query_po_h = "INSERT INTO po_header (ponum, whs, extref, status, supplier, blkord, podate, remrk1, remrk2, remrk3) VALUES ('$ponum_t', '$whs', '$extref', 10, '$supplier', '$blkord', now(), '$remrk1', '$remrk2', '$remrk3') "; $rs_po_h = $db->Execute($query_po_h) or die("Error in query: $query_po_h. " . $db->ErrorMsg()); -- The problem here is it works on the development machine but doesn't work on the server. It is not generating error message at all. And only this particular query is not working. Other queries with the mysql database be it insert, update, delete or select works fine. Any idea why php-mysql will not work and still don't generate any error message?
View Replies !
View Related
Inserting Data Into Multiple Tables
I am just learning both MySQL and PHP, and have a question about a project I am working on. The first (and main) table for this project has the basic information about an refund request, including an autoincrement unique ID. Another table includes the products and uses the ID as a reference. The third table is the history of everything that happens to the request. For example, the information may be as follows. Credit table ID - autoincrement status - requested, needs authorization, processed, etc agent - who entered the request customer - person requesting the refund other customer info order table ID - reference to Credit table Item - item ID for amount requested quantity - number purchased price - price of each item (total information is calculated on above fields) history table ID - reference to credit table seq - id for each history log old status - the previous status new status- the status after the update to the record agent - agent making the change notes - a description of what was done. I have the PHP form that collects the data to be entered. My question is, since the first table is an autoincrement, what is the best way to insert a record into the Credit table, pull the ID that was just entered into the credit table and insert that ID into the order and history tables?
View Replies !
View Related
Inserting Time Data Into MYSQL
I'm trying to insert an assortment of data into a mysql database. Although I'm having problems when inserting fields with time information. Firstly, it's outputting it as HH:MM:SS and I need it to output as HH:MM. It's also defaulting as "00:00:00" even if I leave it blank. I've set it up as TIME and set the default as blank and NULL ...
View Replies !
View Related
Inserting Huge Amount Of Data In DB
I've got a script that scan .csv files and have to add data in a DB. I've try to save data into array and only insert data at the end in one shot, but I got memory problem. I would like to know the best way to add about 1 million of data in DB. Do I go with one query per data? Do I try to say cumulate like 100 data and then insert them and repeat this until it is done?
View Replies !
View Related
Inserting Large Amounts Of Data Into Mysql
I have a whole bunch of numbers and state, county, city, etc. data that i'm trying to load into a database for a demographics website. The data is all in excel currently so I could easily copy and paste it to a text file or another medium if necessary but I'm wondering what the quickest and most efficient way to get it all entered into mysql is.
View Replies !
View Related
Inserting 100 Rows Of Data Into An Existing Table
I want to import 100 rows of data from an Excel spreadsheet into an existing MySQL table. Both the spreadsheet table, and the MySQL table have the same exact format & headers. In MySQl Query Browser, I can locate only the Edit function, which seems to only allow me to type in the data line by line. Can I import the data in MySQL Query Browser, or do I need another product? And if I can import, how do I do this?
View Replies !
View Related
Inserting Data Into A Table From A Text File
I have a table in MySQL with the columns: "ID, JokeText, JokeCategory, JokeDate". I want to take a text file that is a long list of jokes, and load each joke into a new row of the table in the JokeText field. I have tried a bunch of different approaches, and just can't get it to work right. Can anyone enlighten me? If it helps, here is a sample from the jokes text file (yes, they are stupid :P) Q: What goes up and down but does not move? A: Stairs %% Q: Where should a 500 pound alien go? A: On a diet %% Q: What did one toilet say to the other? A: You look a bit flushed. %% Q: Why did the picture go to jail? A: Because it was framed. %% Q: What did one wall say to the other wall? A: I'll meet you at the corner. %%
View Replies !
View Related
Table Breaks After Inserting Data With MyISAM
One of my tables keeps getting broken after I add a bunch of data to it. I have reinstalled MySql and recreated the DB several times. In mysql 5 it says the table was marked broken and in mysql 4.1 it says "Got error 127 from storage engine". After I use repair table almost all of the data is gone, and only 10 from 1104 added rows remain, but it's always the same rows. It's the 10 rows where the value for volume is 0 (well it's 000 in the query). I am using the MyISAM DB-engine on my tables. I can fix this problem by changing the db engine to InnoDb, but I wonder why it doesn't work properly with MyISAM? the DDL code for the table is like this: CREATE TABLE `quotes` ( `ID` int(10) unsigned NOT NULL auto_increment, `security` mediumint(8) unsigned NOT NULL default '0', `open` float unsigned NOT NULL default '0', `high` float unsigned NOT NULL default '0', `low` float unsigned NOT NULL default '0', `close` float unsigned NOT NULL default '0', `volume` int(10) unsigned NOT NULL default '0', `splitfactor` float unsigned NOT NULL default '1', `date` date NOT NULL default '0000-00-00', PRIMARY KEY (`ID`), UNIQUE KEY `unique_security_date` (`security`,`date`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 CHECKSUM=1 DELAY_KEY_WRITE=1 ROW_FORMAT=DYNAMIC AUTO_INCREMENT=1 ; I uploaded the insert query I used here: http://users.skynet.be/ecare/insert_quotes.sql
View Replies !
View Related
SQL*plus Inserting New Row With Values = To Existing Rows Data
I am trying to insert a new employee into an empolyee table and get some of the values (namely phone no.) to be the same as what another employee currently has. This new employee is replacing the old employee, but i have to keep the old employee alive in the db as other data is reliant on its existance. I was wondering how do i insert the new employee asking the, VALUE ('etc', 'etc',) line, to assign a value to certain fields equal to the value contained in other employee rows.
View Replies !
View Related
Inserting Data From Text File Question
I have a sql table with about 9 fields of data in it.The first 3 are filled and the last 6 are currently blank. I have a tab delimited .txt file containing data for each of the 9 fields and want to import it in phpmyadmin to both overwrite the existing data in the 3 fields and fill out the other 6. However I only want to import the data where one of the existing filled-out fields "TournamentID" equals 10. But I'm unsure how to do this. Will this work?: SELECT * FROM `tbl_finish_pos` WHERE TournamentID=10 then check every row returned and select the Import tab in phymyadmin to insert the .txt file
View Replies !
View Related
Inserting Multi Table Data To Flat File
I have two tables; trying to get the data in to one row for the result set. Example: t1: iddescription 1apples 2oranges t2: idt1_idlabeldate 131added2008-01-23 141modified2008-01-23 132added2008-01-24 142modified2008-01-24 The result I would like to see is as follows: iddescriptiondate_addeddate_modified 1apples2008-01-232008-01-23 2oranges2008-01-242008-01-24 Looking forward to your solutions!
View Replies !
View Related
Query For Month Data Based On Occurance Against Master List
I have a query running nicely. Now I'm trying to expand it. It pulls the data from a table based on matching the id with another table and part of the grouping is by month and 2 other criteria. Now I'm trying to get the data pulled by month to pull only the info where the id matches the master file AND the FRANID's pulled are the same for each month. I'm trying to get a comparisson across times, but not every month has all FRANID's, depending on when they were entered and I ony want data that exists with matches over set months, starting for now with 12, perhaps also for 6 and 3 next time. I've simplified what I'm doing above, but it is detailed below.....
View Replies !
View Related
Using A Field, Which Is A Comma Separated List, As The List In An IN Comparison Test.
The following query only reads the first character of a comma separated list stored in a field of the records being queried. The varchar field in table d named "display" holds 1,4 The query " select * from d where 4 IN (display) " tests false. If I change the field "display" to 4,1 Then the query tests true. It is either testing only the first character, or is stopping at the comma. I need this to test true if the value is anywhere in the list, what am I doing wrong here?
View Replies !
View Related
Full List Of MyTable21 And Some List Of MyTable22
data in myTable21 (id) country (1) Canada (2) France (3) Egypt (4) America data in myTable22 (id) city name (1) Montreol Jane (2) Paris Mary (3) Cairo Tom (4) New York Jane (4) Chicago Tom I have data in myTables like the above. The following code produces the following result. but I like to produce my target result. code1 select myTable21.id, name, country, city from myTable21 left join myTable22 on myTable21.id=myTable22.id where name='Tom' result1 (3) Egypt Cairo (4) America Chicago target result1 (1) Canada (2) France (3) Egypt Cairo (4) America Chicago code2 select myTable21.id, name, country, city from myTable21 left join myTable22 on myTable21.id=myTable22.id where name='Jane' result2 (1) Canada Montreol (4) America New York target result2 (1) Canada Montreol (2) France (3) Egypt (4) America Chicago code3 select myTable21.id, name, country, city from myTable21 left join myTable22 on myTable21.id=myTable22.id where name='Mary' result3 (2) France Paris target result2 (1) Canada (2) France Paris (3) Egypt (4) America How can I get the full list of myTable21 and selected values from myTable22?
View Replies !
View Related
Partial Matches
I'm trying to run a query that takes one field and looks for likeness in another and returns the matches. For example: The field is mobile_no (mobile phone numbers no in 646-555-1212 format) and I'm tryna get matches against the field npa_nxx (NPA-NXX codes in 213-555 format)
View Replies !
View Related
Partial UPDATE SET
Is there a way to have a column partially updated. Lets say you have credit card information and you want to turn all the numbers but the last four into "*". I don't want to do this with PHP, can MySQL do this?
View Replies !
View Related
Partial Postcode
Are they any string comparison functions that could find a partial match between the search term and a specific column? For example: if the search term was SP1 then it would return rows containing: SP10 1ES SP11 7BG A previous developer where I work has created some code to achieve this but it strips off characters 1 at a time and keeps querying the database, which doesn't seem like a very good way to do it.
View Replies !
View Related
Partial Syncronization
We basically need to syncronize a part of a central database to various mobile or pc based users. For example, we will have a central database to store all company data for all companies using the system. Then we need to have a 2 way syncronization between the mobile devices and pcs with only the data relevant to that company. Is there some sort of engine, middleware, etc that is flexable enough to do this or is it something that I will have to do myself? If I have to do it myself, what is the best way to handle 2 way syncronisation (id records created simultaniously on 2 separate system that have to syncronize)?
View Replies !
View Related
Partial Match
How to do partial matches? Data in a column = " has been demonstrated" another column can have another set of terms 1: been demonstrated 2: Car has been demonstrated 3: car demonstrated in the 1) its easy to pattern match using %been demonstrated% however how to do it in the second case and even worse the 3rd case. I think it could be done by back referencing in regular expression. But how to backreference in mysql?
View Replies !
View Related
Partial Replace
I have a field called ref_no containg data like this: 14a-12395 How would I replace the 14a- part to be left with 12395 ? PS, the 14a could vary with the no of characters, ie it could be 9a- or 124a- Ive tried THIS, but it doesn't affect any rows: update company_tbl_copy set ref_no = replace(ref_no,'%-','');
View Replies !
View Related
Storing Partial Dates
I am creating my first mySQL database to store genealogy information and would like fields for date of birth and date of death.Unfortunately some older records are quite vague with only the year being available in some cases. I am concerned that if I store only the year or month & year where available then when the information is retrieved then the missing information will be defaults which are incorrect. For example if I store the date of birth as "March 1900" how can I avoid this being retrieved as "1st March 1900" Would it be best practice to store the day month & year in separate fields ?
View Replies !
View Related
Comparing Partial Strings
Suppose I have a varchar field "A" in my table that has a value '120 g' I have a variable $weight=120; Now I want to run a query which compares $weight to 120 of field A Can I do that? I think I will have to extract the number from 120 G and then do the comparsion.or something like that/
View Replies !
View Related
Partial Match Mysql 5
Is there a way in mysql 5 to perform a partial match. I have achieved what I need but it is outside of mysql and it costs a lot in time. What I mean is: SELECT a,b,c FROM table WHERE a > 0 AND b > 0 AND c > 0 would select all rows with 2 of the 3. I could create a statement like SELECT a,b,c FROM table WHERE (a > 0 AND b > 0) OR (a > 0 AND c > 0) OR (c > 0 AND b > 0) but I was hoping to do something easier
View Replies !
View Related
Matching Partial Strings
I've been working all day trying to figure out how to do this query and have exhausted all of my resources.i'm trying to find relationships between the 'category' field of my "songstab" table which can contain more than one category separated by commas and the 'category_set' field of my "category" table which has all of the possible categories as it's rows. it works fine if there is only one category in 'songs.category' but doesn't return anything if there are more than one item (ie. Drama,Comedy,Action). how can i get it to recognize the partial string matches?
View Replies !
View Related
|