Inserting Multiple Rows Of Same Value
I have an auto-incremented column and I need to be able to insert one value hundreds of times. Does anyone know an efficient means of doing so?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
MySQL Inserting Rows Out Of Order
Using PHP, I generated a query file that has several thousand INSERT statements in it. The problem is that when I run the INSERT query, the rows are NOT added to the table in the order in which they occur in the SQL file. The first few hundred INSERTS are inserted toward the end of the table. What is the problem? The way around this is for me to resort the table based on one of the columns so the proper order is maintained. I'm using this with forum software, so it is critical that the table be in order else my boards are out of order. Is there a problem with MySQL or with me? Any ideas why rows would be added out of order?
Inserting Multiple Comments?
I am wanting to insert multiple comments for one username and for one article into a mysql database table. Can someone please tell me how I can do this if it is possible?
Inserting Into Multiple Tables
I am having trouble finding any sort of information that can assist me with the following. Taking information from a single form, then inserting it into multiple tables all at once.
Select / Insert Multiple Rows As A Single Row Of Multiple Columns
I have a nice database set up that contains information about orders and the items on those orders. If an order has 10 items on it, I can select the item data which returns 10 rows of data (let's say 5 colums each). Beautiful! Now I find myself needing to satisfy a program that requires all of the data on a single row. I can do this in a higher level language, but if I could accomplish it all in mysql it would be better. I don't need to sum or do any calculations. I just want to select those 5 columns of data about those 10 rows worth of items as a single row with 50 columns. For example, I'd want this: 1-1,1-2,1-3,1-4,1-5 2-1,2-2,2-3,2-4,2-5 To become: 1-1,1-2,1-3,1-4,1-5,2-1,2-2,2-3,2-4,2-5 The first complication is that the number of items on an order is variable, but is always at least 1 and can not exceed 20. The closest I've been able to get is to do something like: SELECT GROUP_CONCAT(item_number,",",qty,","",description,"",",price,",",location_number SEPARATOR ",") FROM items WHERE order_number=12345 This will give me a single text string containing the value content of the INSERT query (which will need to be manipuated outside of the SQL query to pad it with NULL values for the unused items' columns etc).
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?
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.
Inserting 300M Rows From A Php Script To Mysql
I'm new to Mysql and Php and for the last week or so I'm trying to add 300 Millions rows to a table with 10 columns, the system is very slow and it stops at 200k rows after 4 hours. What I did was to generate a Php script that will automatically insert the same data to the database 300M times. Why is it so slow? Why is it that I can not get pass 200K rows? What can I do in order to improve performance? Note: Already tried to change some parameters in my.ini like........ Example: # Set buffer pool size to 50-80% of your computer's memory innodb_buffer_pool_size=70M innodb_additional_mem_pool_size=10M etc... P3 933Mhz, 640MB SDRAM, 30Gb hd
Inserting Multiple Records Using Checkboxes
I'm working through my fist PHP/mySQL project, and am getting on OK with it. The database structure is as below, with three main tables (Candidates, Vacancies and Profiles) and two lookup tables (CandidateProfiles and VacancyProfiles) : Candidates --------------- Candidate_ID (autonumber) Name (text) ... 1, Iain 2, Fi 3, Rob Vacancies -------------- Vacancy_ID (autonumber) Vacancy (text) ... 1, Cartographer 2, Gardener 3, Occupational therapist 4, Web designer 5, Recruitment manager Profiles ----------- Profile_ID (autonumber) Profile (text) ... 1, Map making 2, Web design 3, Gardening 4, Hand therapy 5, Recruitment 6, Aviation 7, Sport 8, Travel VacancyProfiles ---------------------- Vacancy_ID (number) Profile_ID (number) ... 1,1 1,2 4,2 2,3 3,4 5,5 5,6 CandidateProfiles -------------------- Candidate_ID (number) Vacancy_ID (number) ... 1,1 1,2 1,7 1,8 2,3 2,4 2,8 3,5 3,6 3,7 and from there created two queries CandidatesQuery -------------------- SELECT Candidates.Candidate_ID, Candidates.Name, Profiles.Profile_ID, Profiles.Profile FROM Profiles INNER JOIN (Candidates INNER JOIN CandidateProfiles ON Candidates.Candidate_ID = CandidateProfiles.Candidate_ID) ON Profiles.Profile_ID = CandidateProfiles.ProfileID; 1, Iain, 1, Map making 1, Iain, 2, Web design 1, Iain, 7, Sport 1, Iain, 8, Travel 2, Fi, 3, Gardening 2, Fi, 4, Hand therapy 2, Fi, 8, Travel 3, Rob, 5, Recruitment 3, Rob, 6, Aviation 3, Rob, 7, Sport and Vacancies_Query ------------------- SELECT Vacancies.Vacancy_ID, Vacancies.Vacancy, Profiles.Profile_ID, Profiles.Profile FROM Profiles INNER JOIN (Vacancies INNER JOIN VacancyProfiles ON Vacancies.Vacancy_ID = VacancyProfiles.VacancyID) ON Profiles.Profile_ID = VacancyProfiles.ProfileID; ... 1, Cartographer, 1, Map making 1, Cartographer, Web design 2, Gardener, 3, Gardening 3, Occupational therapist, 4, Hand therapy 4, Web designer, 2, Web design 5, Recruitment manager, 5, Recruitment 5, Recruitment manager, 6, Aviation What i'm a bit unsure about is how my insert / delete pages should be created. (I'm using Dreamweaver). The absolute ideal would be to have a page whereby new Candidates could be entered, along with any job Profiles, ideally by clicking checkboxes, that would then insert the data into Candidates table, and also populate the CandidateProfiles table. I guess something like : if checkbox1 is checked insert current(new) CandidateID into CandidateProfiles.CandidateID and 1 into CandidateProfiles.ProfileID AND if checkbox2 is checked insert current(new) CandidateID into CandidateProfiles.CandidateID and 2 into CandidateProfiles.ProfileID etc If that makes sense, and anyone can point me in the right direction that would be great. Or, if thats cobblers, any direction - but hopefully you get the drift - I'm basically after the most efficient way of entering / attaching any appropriate Profiles to Candidates on the insert / edit web pages.
Inserting Multiple Values In One Column
I have a web form that has a drop down list where you can select more than one item. I'd like both of these values to be entered into the same column in a table. For example, the table is set out as follows TAG_TABLE tag_id user_id software_id all of the above are integers whose value is referenced in another table. eg the software_id table is as follows SOFTWARE_TABLE software_id software The dropdown list in the form is populated from the software table. What happens is that when I select an item from the drop down list say Microsoft Visio it enters the corresponding integer in the main table. But if I select Microsoft Visio and Micrsoft Project, I want both of those integers to somehow be added into the user_id column in the TAG_TABLE. I also have a web based reports form .....
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?
Joins With Multiple Tables And Multiple Rows
I'm making a good ol' forum, and i have three tables, users, threads and posts. when i query my threads table with a join, i need to access the users table twice to get the username of the first poster and last poster. But how? I can only figure out how to get one or the other. Is my design bad? eg SELECT TopicID, FirstPostID, LastPostID, Replies, Views, Topic, username FROM DiscussionThreads, users WHERE DiscussionThreads.FirstPostID=users.ID ORDER BY FirstPostDT DESC LIMIT 10 .
Inserting Into Multiple Tables Using Auto Incremented Field
I'm inserting a record into MySQL 4.0 using Visual Basic ADO. When using the AddNew and Update method I am unable to retrieve the value of a Auto incrment field (Yes I know I can MoveLast but this icreases the update time by a factor of 10 and when your talking about 200,000 inserts its way to long). Is there a way to insert the record into multiple tables in one statement where you can use the value of the auto incremented field as the key in the second table? So the statement inserts the record into a table retrieves the new auto_incremented key and then insterts information into the second table using the incremented key as the primary key?
Inserting Multiple Items (# Unknown) Into A Table Using Primary Id From Master Table
In my database I have a master table for products using a auto-num id column. One product may have several purchase options (items) which have to be entered into another table. To enter a new product and items I use a form that gathers the information for the master product and one item. This information is then inserted into the database. For the items I use mysql_insert_id() to get the id into the items table. My challenge is getting this same id for additional items. Once the user has input the initial product and first item they hit a submit button to call a form for adding any additional items, and this is repeated until all items for that product are entered. The new items are inserted into the database okay, but always with an id of 0. The mysql_insert_id() no longer works. Is there a way to pass this id from the previous insertion to the new one by passing a variable? or echoing input type"hidden"? Or even better yet, Im wondering if I can ask the user at the time of entering information for the product how many items that particular product has and then bring up that many form fields to enter multiple items? Can this be done using something like an incremented loop to call form fields?
Multiple Rows
I've got a whole bunch of rows to create, each with a unique key. Each row gets the same value ("New") set in the "Age" column. I've seen the INSERT INTO table (rows,) VALUES (val for row1), (val for row2), etc.But what if each row gets the same exact value?
Multiple Rows
I was wondering if it is possible to get all of the inserted id's of an auto increment column when doing multiple inserts at 1 time. For example: INSERT INTO people (fname, lname) VALUES ('john', 'smith'), ('eric', 'robinson'), ('mark', 'appley'); is it possible to retrieve all of the insert ids of those inserts instead of having to loop through each individual insert and retrieve each individual row id?
Multiple Rows
I create a table with 7 columns id Mdate col1 col2 col3 col4 col5 as above shown id is small int, mdate is date and col1 to 5 are tinyint and i want to insert the values . id is auto increment and i want mdate a day for one row. and other column set to zero what i want is to enter in single query.
Get Multiple Rows Using Subquery?
I have a query similar to the following, however i'd like to get another row from the subquerys - currency. SELECT *, (SELECT xml_result_value FROM lodging_links_allocation INNER JOIN xml_results ON lod_link_alloc_link_id = xml_link_id AND xml_result_value != 'X' AND xml_nights = 1 AND xml_source_id = 19 WHERE lod_link_alloc_lod_id = lod_id ORDER BY CAST(xml_result_value AS UNSIGNED) LIMIT 0, 1) as price_from_1, (SELECT xml_result_value FROM lodging_links_allocation INNER JOIN xml_results ON lod_link_alloc_link_id = xml_link_id AND xml_result_value != 'X' AND xml_nights = 1 AND xml_source_id = 13 WHERE lod_link_alloc_lod_id = lod_id ORDER BY CAST(xml_result_value AS UNSIGNED) LIMIT 0, 1) as price_from_2, (SELECT xml_result_value FROM lodging_links_allocation INNER JOIN xml_results ON lod_link_alloc_link_id = xml_link_id AND xml_result_value != 'X' AND xml_nights = 1 AND xml_source_id = 12 WHERE lod_link_alloc_lod_id = lod_id ORDER BY CAST(xml_result_value AS UNSIGNED) LIMIT 0, 1) as price_from_3 FROM ( SELECT * FROM [..snip..] GROUP BY lodging_master.lod_id ORDER BY RAND(��-12-17') ) as foo HAVING (price_from_1 > 0) && (price_from_2 > 0) && (price_from_3 > 0) LIMIT 0 , 30
Multiple Update Of 21 Rows
I have a database table which holds price ranges for various classes of hire car and various hire periods. There are 7 different hire classes and 3 different hire periods. 21 records in total. Heres an example of what the table contains: ID......HIRE PERIOD.....HIRE GROUP....PRICE 1..........14.....................a...............25.00 2..........28.....................c...............15.00 The rows are shown in an editable form, which is basically a grid of text fields. I need to figure out the most efficient way of updating all the records when the grid is edited. Do I need to perform 21 individual updates? as I'm worried that this will be too cumbersome when there are multiple users. I thought of one way which involves having a hidden field for each row, called 1,2,3 etc, each with a value of eg. 14,a,25.00 as a comma seperated list. Then I split the post values into arrays and perform various updates. Seems a bit clunky though,
Count Multiple Rows
I have a table that tracks dealer transactions. The fields are Date, Dealership, Amount, A, D, W, F. A=Approved D=Denied, W=Withdrawn and F=Funded. I have made it where if a loan has been approved then A would =1 and D W F would be null. Same goes if the record was withdrawn W would =1 and the other would be null. So here is my problem: I want to group by dealership and then count how many were approved, denied, withdrawn, and funded. i am running version 3.23.58. After doing much research I either need to do unions or subqueries. However, both are not availble until 4.x. Is it possible to do what I am looking to do without upgrading?
Update Multiple Rows
I have about 20 rows that need to updated together and would rather not have 20 seperate update lines but am not sure what else to do. At the moment it looks something like this: UPDATE movies SET mon='10pm', tues='10pm', wed='11pm' WHERE movie_id='19'... UPDATE movies SET mon='9pm', tues='11pm', wed='4pm' WHERE movie_id='37'... UPDATE movies SET mon='8am', tues='1pm', wed='5pm' WHERE movie_id='19'... There is no logical order to the movie_id's they are selected from the movies table using specific criteria.
Collapsing Multiple Rows Into One.
I'm setting up a database of links, where each one can be in multiple categories. I could make each category id a column in the links table, but I'd rather store it in a separate table so I don't have a bunch of NULLs cluttering up the main table and also to allow unlimited categories. That table has two columns, linkid and categoryid. The problem is that I'd like to retrieve it as one row somehow, something like this: "linkid category1 category2 etc..."
Updating Multiple Rows
The following UPDATE query works fine if run directly into phpMyAdmin (I take the $sql output of the script with the data in it and paste it into phpMyAdmin). But it doesn't update my records if run from the PHP script. I can't seem to figure out where the bug is: Code:
Selecting From Multiple Rows??
i have made a voting script... every time someone votes it goes into a table called 'voting'... since people can vote on multiple things in the site there are multiple instances of each user in the 'voting' database... if each entry has a 'userID' a 'ratingGiven' and a 'objectBeingVotedOn' field how would i go about grabbing say the "ratingGiven" field from all of one particular user's entries .
Updating Multiple Rows
I need to update multipule rows a once, using PHP. Here's what I mean. I have a mysql query out put the data as a form like this: Item 1 <input type="hidden" name="id" value="1"> <input type="text" name="order" value=""> Item 2 <input type="hidden" name="id" value="3"> <input type="text" name="order" value=""> Item 3 <input type="hidden" name="id" value="4"> <input type="text" name="order" value=""> <input type="submit"> Order need to be updated. I could setup to do a loop with multiple queries.
Update Multiple Rows
I have an array that I need to put into an existing db column using a perl foreach loop. I can do this using an INSERT statement but the script will be run every day and the source array will be changing as it is based on directory contents so I need to UPDATE vs. INSERT With the INSERT statment the script places each array element on a new row of the db as it should but when I try to use an UPDATE statement, I get a single array element written over and over on each row of the db. Code:
Insert Multiple Rows
I want to insert multiples rows and use sintax "INSERT INTO tbl_name (a,b,c) VALUES(1,2,3),(4,5,6),(7,8,9);". But, I get the following error: "Column count doesn't match value count at row 1". The number of fields is the same, only that insert multiple rows.
How To Evaluate Multiple Rows As One Using IF( )
Each record for a PhysicalSource has a Status number. I need to do a SELECT statement to find out if there is a Status = 2 in any of the records. If Status = 2 then I need to return all rows for this PhysicalSource else if Status != 2 then I need to exit the query (don’t return anything). The statement is as follows: SELECT SourceID, OriginalTime, State FROM sources WHERE SourceID = ? AND PhysicalSource = ? AND IF(Status = 2, 0, 1) Order by SourceID ASC As I found out the “IF(Status = 2, 0, 1)� evaluates every row and returns all others with Status !=2. The options are limited, I inherited a GUI (can’t modify it) that must be use and only accepts one query at a time using MySQL version 4.1.11. Could someone help with a way to have this evaluate multiple rows, as one, and if in any of them Status = 2 then exit the query?
Matching Multiple Rows
I've got the following tables with the following columns: property: id, address, number_of_bedrooms attribute: id, title (e.g. washing machine, central heating, furnished) property_attribute: property, attribute (composite primary key on both id columns) what i'm trying to do is select property ids that have all the attributes i'm looking for, for example, all those properties that have a washing machine and are furnished. I've been trying things like the following which aren't working, probably because the attribute column won't be equal to two different values at once. SELECT pa.property FROM property_attribute AS pa INNER JOIN attribute AS a ON pa.attribute=a.id WHERE a.title='washing machine' AND a.title='furnished' this is returning an empty set because, i think, a.title can't have two values at once. what i want to say in pseudo-sql is: SELECT pa.property FROM property_attribute AS pa INNER JOIN attribute AS a ON pa.attribute=a.id WHERE (pa.property=X AND a.title='washing machine') AND (pa.property=X AND a.title='furnished') so the only results that will be returned are where a property has both attributes. i can't think of how to do this since there will be varying numbers of attributes i need to search on. perhaps i need to use a variable for pa.property - i tried that, setting it to SELECT DISTINCT property FROM property_attribute, but mysql didn't like it because this query returned multiple rows. i may need some kind of set variable or an array.
Select Multiple Rows With The Same Id
So I have this table: table_name id_one ---- id_two 1 ---------- 1 1 ---------- 2 1 ---------- 3 2 ---------- 1 2 ---------- 3 I want to select all of the id_one rows where the id_two is '1' and '2'. The desired output is: id_one 1 1 Later I might use SELECT DISTINCT to produce the following: id_one 1 So far I have: SELECT id_one FROM table_name WHERE id_two IN ('1','2') But this selects all the id_one rows where id_two is '1' OR '2'. I want the rows where it is '1' AND '2'.
Delete Multiple Rows At Once
My question is, what code would i use to delete multiple rows of data at the same time. if i had: username password userid john fubar 13402 mike yippy 13679 and i wanted to erase both users in one query, what would it be?
Subtracting From Multiple Rows.
I'm wondering if it's possible to subtract a single value from multiple rows. For example, say I have two rows containing pieces of an account balance, which add up to a total balance. We'll say the two rows hold balances of $10 and $20. Now I want to subtract $25 from them (meaning subtract $20 from one and $5 from the other). Is there a way to write this in one query? If I use the SUM() command can I subtract from the total instead of each unique row?
Updating Multiple Rows
I am running the following UPDATE statement UPDATE history set t_own = t_user * 0.75 where user_cur = 7 and lg = 'Local' t_own and t_user are defined as DECIMAL 12,2 650 rows should be updated, but i get error 1136 Column count doesn't match value count at row 1.
Insert Multiple Rows At Once
I was faking it a couple of years ago when I made my first database for my photography website. Now I'm updating it and I'm inserting One item at a time manually thru PHP. It's slow and tedious and I've got 467 entries to do.... I'm sure there's an easy way of doing it all at once. I'm just too much of a retard and I'm too tired to try to learn some MySQL tonight. Could someone please help me? Here's the query that I'm ending up with. (I started at Number 100, I'm increasing the Number by 100 each time and I need to go to Number 46700.) SQL query: INSERT INTO `Headshots` ( `Number` , `Category` , `Name` ) VALUES ( '2800', 'Head', '' );
WHERE Accross Multiple Rows
Suppose you have a table: Code: attribute_id file_id attribute_value 1 81 11076 2 81 BONAP 3 81 2 4 81 2004-09-09T00:00:00 5 81 JIM01 6 81 Bon App 7 81 Margaret Peacock 1 86 11072 2 86 ERNSH 3 86 2 4 86 2004-09-01T00:00:00 5 86 PO7859 6 86 Ernst Handel 7 86 Margaret Peacock How do you find the file_id that has attribute_id = 1 and attribute_value = '11072' and attribute_id = 2 and attribute_value = 'ERNSH'?
Updating Multiple Rows.
I went to MySQL home page and found one comment that kind of tried to explain it but it was written in such a manner that I could make no sense of it at all. I am trying to find a way to update a row with 12 entries in a table that has 12 teams (teamid) and 12 ranks (r1,r2,r3...r12) the data to update the teamid comes from a form and they would all be updated (unless everything remains the same) with the use of the said form. I am not certain how to make this work (call the table 'team') PHP Code: UPDATE team SET teamid='team1', teamid='team2'...teamid='team12' WHERE?
Adding Multiple Rows Into A Table At Once
I have to the stage of being able to easily(?) add new rows to my tables using the command insert into zone_vs_weight (low_mass, high_mass, zoneA, zoneB) (1, 250, 4.50, 6.35); It seems to work well for adding single rows but can we use it to add multiple rows i.e. insert into zone_vs_weight (low_mass, high_mass, zoneA, zoneB) (1, 250, 4.50, 6.35) (low_mass, high_mass, zoneA, zoneB) (251, 500, 6.50, 8.50) .........; Is there another command apart from the input file insertion or using PHP? I have been using K. Yank's fine book 'PHP & MySQL' as a good primer but it doesn't seem to mention whether it is feasible.
Updating Multiple Rows In One Query
tried to find the answer with search but didn't return any answers. OK, here is the table table test ------------------------ | test_id | test_order | ------------------------ | 1 | 1 | ------------------------ | 2 | 2 | ------------------------ | 3 | 3 | ------------------------ I'm trying to change the orders in one query, but not sure how to do that. phpMyAdmin shows me the code like this Quote: $sql = 'UPDATE `test` SET `test_order` = ƈ' WHERE `test_id` = 1;' 'UPDATE `test` SET `test_order` = Ɖ' WHERE `test_id` = 2;' 'UPDATE `test` SET `test_order` = Ƈ' WHERE `test_id` = 3;' . ' ' I'v tried that but got a syntax error. MySQL version is 4.0.26, can anyone help please?
Adding Up Data From Multiple Rows?
If I have numerical information stored in different rows what is the best method to find the sum of all the numerical information in the rows?
How To Update Multiple Rows With One Query?
I am using PHP/MySQL and need to update 7 rows with one query. Can someone tell me how to do the following so it will update the row for each day of the week? (This obviously doesn't work) $sql = "UPDATE business_hours SET hours='$sunday' WHERE id='$id' AND day='sunday' AND SET hours='$monday' WHERE id='$id' AND day='monday'";
Query Pulls Out Multiple Rows Even Though Theres Only One
Ive got a query thats selecting info about a product from a table called items and joining on a table called itemimages to get its associated images. The product can have more than one image. If i run the query on an item with 2 images i get 2 results for one item.....when theres only one item.....it seems to duplicate the item for each of its images.... SQL SELECT items.*, itemimages.* FROM items INNER JOIN itemimages ON (items.itemID = itemimages.itemID) WHERE categoryID = '$category' AND active = 'yes' LIMIT $start, $limit"
Count Fields Over Multiple Rows
I have a database like this id, field1,field2,field3,field4,field5 Database contains 100 rows, some rows have no fields filled, some 1field , some 2 fields etc. How would i count the number of fields filled in total? So the outcome is (number of fields filled in row1)+(number of fields filled in row2)+(number of fields filled in row3)....................+(number of fields filled in row100)
Concatenating Multiple Rows To One Field?
I got a slight problem with a web application, its supposed to several entries for a certain ID, and display them as one string. Example: ID | Name ------------- 1 | Jack 1 | Peter 2 | John 2 | Mark 2 | Ellis Expected Result for ID 1 should be "Jack, Peter" for example, or "John, Mark, Ellis" for 2. Least problem would be clipping off a trainling or leading ",", but the main problem is a SELECT statement to get them all in one go. Else I'd have to select every Name per ID, and concatenate them in PHP or elsewhere. Given its around 100 IDs, I'd have to do like 100 querys to get the names, *in addition* to the Querys I need before and after. I want to avoid that, but I couldnt find a simple solution that works in MySQL 4.1 and above, aswell as it mustn't involve Stored Functions or something, because I got no access to the mysqld itself, to add the funcs as modules. Code:
Delete Rows From Multiple Tables
I am writing a simple PHP script to completely remove all references to a user from a whole bunch of tables (the "user" in this case is really a row of data identified by a user_id field within that row). I tried to use "DELETE FROM * WHERE user_id = $whatever_it_is;" but clearly that would be too easy. What is the proper way to do this?
Add Multiple Rows To An Existing Table?
I have a table named manufacturers, it has one row in right now. I want to upload all of my manufacturers into the table. Is there a way to add multiple rows to the table at the same time? If not, what is a quick way to get about 1,000 manufacturers uploaded into a table?
|