Given Field Name, Find Table That Has Tha Field Name?
Is there a quick way to identify tables that have a specific column in them? For example, if I have a column name 'RuleName', how can I need to find all the tables in a database that have a column with that name?
View Complete Forum Thread with Replies
Sponsored Links:
Related Messages:
Retrieve Field Value When Submitting To Table Auto Increment Primary Field Value
In my form, I write to four fields in the table, (fields 2,3 4 and 5), which creates a new record. the first field of this new record is an auto-incremental field, giving a unique id. How can I write to the table and at the same time retrieve that unique id accurately, even if more than one person is performing write tasks simultaneaously? My first thought is that if I grab the previous records id and add 1, then this may not match my newly inputted record, given that it may take a few minutes to add the record and someone else could have been there before me with a different record. (I hope that makes sense). Then I thought that on opening the form, it could write to a new field inputting my loginID. Then I can retrieve the unique auto-increment number before then filling out my form and over-writing the loginID that I had previously entered. Sounds too convoluted to be the best way.
View Replies !
View Related
Find And Replace Certain Field
I need a mysql query that i can run on a certain field in a table and get all entrys that contains a certain bit of info and the replace it with something else, so basically a find a replace query, So what would the query be to do this?
View Replies !
View Related
Find Field Exist
I've two 2 tables video and audio where i need to get all the fields from table video and no fields from table audio. the two tables are having video_sid in video table and audio_sid in audio as common fields. If the video table has video_sid and its corresponding audio_sid doesn't exist then it is said to have only video information and vice versa. If video_sid and audio_sid having same values exist then it is said that video and audio information exist for say an item. So if i need only video information how can i join audio and video tables so that i get only video information(Video only items).I've tried as below but doesn't work.Code: SELECT * FROM VIDEO V JOIN AUDIO A ON (isnull(a.audio_sid)) WHERE VIDEO_TYPE='MPEG1';
View Replies !
View Related
How To Find A Field Exist Or Not? Plz Help.
I've two 2 tables video and audio where i need to get all the fields from table video and no fields from table audio. the two tables are having video_sid in video table and audio_sid in audio as common fields. If the video table has video_sid and its corresponding audio_sid doesn't exist then it is said to have only video information and vice versa. If video_sid and audio_sid having same values exist then it is said that video and audio information exist for say an item. So if i need only video information how can i join audio and video tables so that i get only video information(Video only items).I've tried as below but doesn't work. SELECT * FROM VIDEO V JOIN AUDIO A ON (isnull(a.audio_sid)) WHERE VIDEO_TYPE='MPEG1'
View Replies !
View Related
Help With Moving Data From One Table Field To Another Table Field
I am a relative newbie at this so would appreciate help - already searched and found and tried several suggestions for similar issues - but nothing quite worked! I need to move a membership roster to another table in the same db - currently the data is at jos_users1 and it needs to be moved to jos_users. The jos_users1 table has only one field, named email. The jos_user table has several fields including the email field, and already has data in it - so I don't want to overwrite the table - just upload the additional email addresses into the table.
View Replies !
View Related
Find Closest Row By Timestamp Field
Firstly, if the majority of queries to my sql dbase are done via my TIMESTAMP field, should that be my primary key? How can I find the row with a TIMESTAMP value closest to a given timestamp? And is this a bad way to do this? Each table holds a row for each minute in a year (1440 * 365 = many rows) so that could cause quite a performance hit.
View Replies !
View Related
Update One Table Field With Another Table Field
i am having a problem in my update function. I have two tables: buyselldata table and autozack_signal table buyselldata bsignal coloum has to be updated with Close_Price in autozack_signal table if macd_buy in autozack_signal is 1 common field in both tables are Script_Name "Update buyselldata b set b.buy = a.Close_Price where exists(select Close_Price from autozack_signal a where a.script_Name = b.script_Name and a.macd_buy=1)"; i am getting -1 for mysql_error()
View Replies !
View Related
Updating Table Field From Another Table Field
I have a field called 'tel1' in table 'live_properties' and I want to update a 'tel1' field in 'live_properties' with 'phone_num' field from 'usersTBL' MYSQL code is here but giving error any suggestions UPDATE live_properties SET tel1 (SELECT phone_no FROM usersTBL WHERE username = live_properties.username)
View Replies !
View Related
Extracting Field Data And Putting Each Field Into A Shell Variable?
In a MySQL query on the database (one table with 15 variable length fields, I want to put each field into a Bash variable so that I can handle each field as an entity. The query I have is something like this: mysql -e "use $database; select field1, field2, field3..., from Table1 where fieldN like '%something%';" can I / How do I do something like: mysql -e "use $database; select field1,..., var1=field1, var2=field2,....;" do stuff with var1, var2..., done
View Replies !
View Related
Can I Store The Sum Of Row's Child Rows' Field In A Parent Field?
Sorry if this has been posted before; I am not sure what to search for. I have a table of users, `users`. In the table `users` there is a row which stores clicks, `users`.`clicks`. Each user has it's own referrer, `users`.`referrer_id` which refrences the referring user's id. In the referring user's row, I would like a field to store referral clicks, `users`.`referral_clicks`. I would like `users`.`referral_clicks` to be updated each time that a child user's `users`.`clicks` field is changed. Is this easily possible in MySQL?
View Replies !
View Related
Regular Expression :: Search In One Field Concatenate Result In Other Field
Here is a tough one and it might not be possible but I hate to give up without a fight: I'm trying to make a query that runs through a database and searches for a regular expression in one field, then concatenates what it matched to the end of another field. Is this possible or do I have to concatenate the whole field? Can you use regexp with replace and concat at all or is it only used in the where clause? Normally I'd use a program to hold the value it matched and then run it in a different line but for this I need to use only mySQL. It kind of implies a reversed syntax because it needs to search for the string before it updates.
View Replies !
View Related
How To Convert A Varchar Field Into Proper Mysql Date Field?
I have a database in which the date is stored in varchar field in a following format: d-m-Y (06-08-2007), now the problem is that I want to change that field into mySQL date field as well as convert my older dates into MySQL date format i-e Y-m-d (2007-08-06).. There are about 300 old entries..is there a way I can do that automatically without manually re-entering the dates again?
View Replies !
View Related
Field Not Updating Using CONCAT() Function When Field Is Empty
i have used the mysql CONCAT($existingvalue, $newvalue) function as part of an update query where the input given is suppose to concatenate with the existing value of the field in the database. this works only when there are value/s in that field, when there is know exising value in the field the update query does not work on that field. how ever update on any other field works fine(not using the function) at the same time.
View Replies !
View Related
Using Field Contents As Needle To Search Haystack Field
I have two tables. One has a serial number field, the other has a comments field that may or may not contain a matching serial number somewhere in the field. I know this is a bad example, but, I need to be able to do a search like this: Select * from frog a left join turtle b where b.comments like "%(a.serial_number)%" I need to end up with only the records where one of frog's serial numbers appear in one of turtle's comments fields. I've tried looking a number of different solutions (variable assignment, Locate string with if statement) but I cannot get anything to work, or find any good examples of this. I know how to do it with PHP, but I'd like to stay in MySQL.
View Replies !
View Related
One Field With Multiple Attached Rows, Only Show The Field Once?
I have a table called "Customers", with a field called "Customer name" and a "Customer ID". I have another table called "Projects", with a field called "Project name" and a field called "Customer ID" which references to "Customers" What i am trying to do is: Select a customer. Select the projects that are related to the customer by comparing the Customer ID field. Code:
View Replies !
View Related
Create A Field By Deleting A Part Of The String From Another Field!
I have a table for "Addresses", which has a column titled "Address" and the records in this column are a combination of house#, street name and street suffix, which typically looks like "100 Main Street". I am looking for a query result wherein a new column would be created which would have only the street name and the suffix and would eliminate the house #s, hence the result would look like "Main Street".
View Replies !
View Related
Find A Field With "x Amount Of Characters"
Once again I believe I am overlooking the obvious I am trying to create a query, in which the "WHERE" clause looks for a fixed amount of characters in a field. A simple example: SELECT user.id, phone.id FROM 'users' WHERE 'phone.id' (IS ONLY 7 CHARACTERS LONG) I've tried a fixed amount of wildcards (ie: WHERE 'phone.id' LIKE "%%%%%%%") but it doesn't limit the number of characters to 7. Am I missing the obvious - or is this not possible? For the record, I'm using MySQL 5
View Replies !
View Related
Field Type :: Time Field With Decimal
I want to add times into a field in the form mm:ss.d such as 03:33.5 but when I use the time type it removes the decimal but I really need it to keep it in. At the moment I am using a char(10) type and converting it in my scripts. Is there a way I can add it in using the correct type? I couldn't see anything in the documentation on the time type except that you could enter it in the form I want but it will convert it.
View Replies !
View Related
Copy Field Over, Then Update The Original Field
I want to change a price of a product, but back up the old price. I was trying to do this through two queries, an INSERT and an UPDATE, but it's not working. INSERT the row that will store the backup: INSERT INTO s01_MUS_SalesXProducts ( s01_MUS_SalesXProducts.sale_id , s01_MUS_SalesXProducts.prod_id ) VALUES ( ".(int)$sale_id." , ".(int)$prod_id." ) Then I would copy the prices over and update the original with one UPDATE query: UPDATE s01_Products LEFT JOIN s01_MUS_SalesXProducts ON s01_Products.id = s01_MUS_SalesXProducts.prod_id SET s01_MUS_SalesXProducts.old_price = s01_Products.price , s01_Products.price = ".(float)$sale_price." WHERE s01_Products.id = ".(int)$prod_id." However it is copying the new price to the backup field. Is there a way to do this in two queries? I know if I select the product price before inserting I can do it in 3. Truely I would like to do this in 1, but I don't believe this is possible due to the nature of the queries.
View Replies !
View Related
Updating Rows In Table B Based On Related Field In Table A
Ver 4.1.8-standard for apple-darwin7.6.0 on powerpc (Official MySQL-standard binary) I am trying to do some data migration based. I have several tables that contain our legacy pkey field and I want to update the tables with new ID's. I need to do this several times and have tried it several ways to no avail. Table A --------- companyID int(10) pKey legacyID int(10) old legacy pkey Table B --------- bAID int(10) pkey companyID int(10) legacyID int(10) Table A has values for both companyID (unique key) and legacyID. Table B has values for bAID (unique key) and legacyID but companyID is empty. I need to update tableB.companyID with tableA.companyID based on tableb.cSerialID to tablea.cSerialID relationship. I need a query that will update ALL rows.
View Replies !
View Related
Date Field, Time Field
I have a MySQL date field (e.g 13/12/2006) and a MySQL time field (e.g.13:00) in the same row. I'd like to join these two fields to make a date/time field (e.g. 13:00 13/12/2006) and to be able to sort the query results on the resulting field.
View Replies !
View Related
Replace Function :: One Field From Value Of Other Field
I have two tables I need to replace values 'Field61' and 'Field62' from table 'keyword' from source 'descripcion' and 'numero' from table capital where the FileID from table keyword is equal to FileID from table capital y think on this REPLACE INTO keyword (Field61) SELECT descripcion FROM capital C WHERE C.FileID = FileID --->(how do that this FileID be a keyword.FileID???)
View Replies !
View Related
Copy Data From 1 Field To Second Field
i have db with 1 table on this table i have 2 fields and i need copy data from field to the second field my db name is exmpdomincom_dbmysql1 table name: 2206_listings source field name: URL destenation field name: firstlink what is the command that i need to use in phpmyadmin ?
View Replies !
View Related
Updating Table Based Upon Matching Field In Second Table
I have a database of books that was originally created as a flat file. Each record has a number of fields, including the authors name. I'm trying to convert the database to something a little more efficient. I've created a new table (called Authors) of unique authors names and assigned each one a unique ID. I've added a new field in the original table (called Books) for the author's ID. Now, I need to update the original table with the author ID from the Author's table. Something like this: UPDATE Books SET AuthorID = Authors.AuthorID WHERE AuthorName = Authors.AuthorName This obviously doesn't work. Any assistance on how to forumulate this query (or, if I'm headed down the wrong path, the correct way to do this operation) greatly appreciated.
View Replies !
View Related
Field In Table 4
tables are like this: 1 Region (Region_ID, Name) 2 Station (Station_id, Name, addr1) 3 Transmitt(Station_ID,Region_ID) 4 Distribution (Film_ID, Station_ID, inregion) so the scenario is this. Given a Region I want to update the inregion field in table 4 for any stations in that region, given a film_ID as well. I could do this with several SQL statements, and lots of loops, but I get the feeling that SQL must be able to do this in one (if somewhat complicated) SQL statement.
View Replies !
View Related
A Table Or A Form Field
If I have a db where people enter in their basic info...one of those things being the country they live in....Is it better to make a seperate table in the databases with the country names OR...just put the country names as options in the html form dropdown list?
View Replies !
View Related
Order By Field From Other Table
("SELECT * from `offers` WHERE `status` = 'On' ORDER BY `pay_value` ASC"); I need to pull the "pay_value" from 2 different tables and then order it by that only. The first table is called `offers` and the field I'm referencing is `pay_value` type decimal(10,2) and the second table is called `exceptions` with a `pay_value` type decimal(10,2). What I'm doing is showing a list of ads with the amount of money that each ad pays per lead/sale. Some of our clients have been given increased payouts. Well, when they go to sort all of the ads in the system via the 'Pay Value' I can't make it show the increased payouts from the `exceptions` table while at the same time, being in correct order with the other `pay_value`'s from the `offers` table. I've tried the following: PHP Code:.....
View Replies !
View Related
Table Field Limit
Does a MySQL Table have a limit of fields that you can go up to or can you have an infinite number of fields?. This is, although simple for some here, a necessary question to be answered nonetheless. If it is what I fear (that there is a limit of 256), then I will need to make some massive changes to a project I'm on..
View Replies !
View Related
How To Add Several Details To One Field In Table?
I have been adding my info into my database so far like this: INSERT INTO mytable SET Name = "Harry Bucket", Products = "chair", Suburb = "sydney", ResLink = "harrys_page.php"; BUT, harry has more then just a chair under his product listing... how would i add several products that relate to the 1 field?
View Replies !
View Related
Selecting From A Table Field Twice
example fields of table particle: id radius i j k Each entry in the connections table has the id of 2 connecting particles example fields of table connections: id1 -> id of the particle id2 -> id of the connecting particle What I want to do is form a query that will list the particle information for each particle and its connection. For example, for each entry in the connections table, I want to list: id1, radius1, id2, radius2 (where 1 would be the particle and 2 would be the connecting particle). I'm working with this query at the moment: SELECT x.id1, x.radius1, y.id2, y.radius2 FROM (SELECT id id1, radius radius1 FROM particles WHERE id=id1) x, (SELECT id id2, radius radius2 FROM particles WHERE id=id2) y;
View Replies !
View Related
Copy Field To Another Table
I have 2 tables and would like to populate field2 in table 2 with the user field from table1. All i can find is examples of UPDATE for moving data within the same table. How do I UPDATE field2 with data from Table 1?
View Replies !
View Related
INSERT New Field In Table
I create a table and two fields for it. The table has a user_id & username field. I want to insert a new field called userpw (user password) into the already existing table.. Also the table name is wfe_users
View Replies !
View Related
How To Search A Value In Any Field Of Table??
I need to find a value in a table, the table i create have 26 field ( named as R1 ~ R26), but i don't know the value is in which filed, normally a database should have a reference field, so when we need to search for some value, we just simply type "SELECT * FROM table WHERE field like '%value%' ". But in this case, i dnt have a reference field, what command i can use to solve this problem??
View Replies !
View Related
New Field In Table 'XMLFILE'
in that table a hav added a new field ALTER TABLE `PLD_LINK` ADD `XMLFILE` MEDIUMBLOB NOT NULL ; INSERT INTO `PLD_CONFIG` (`ID`, `VALUE`) VALUES ('ENABLE_XMLFILE', '1'); is this right what i am trying to store in that field is xml files i also would like them to be searcheble can i use the format MEDIUMBLOB the file size is maximum 10mb each andf i am going to have about 400 files and i dont now if this is even possible .
View Replies !
View Related
Using Value Retrieved As Table Name/field Name
"SELECT a.name, a.type, a.color, b.* ". "FROM db.table1 AS a LEFT JOIN ". "db.table2 AS b ". "ON (a.id = b.id)". "WHERE a.qid = '$id'"; 1. Ok, now for the second table, I want to use the value retrieved in table1 as the table name, like this: "db.(a.type)AS b" but obviously this is not working. 2. And for table2, I want to select a field name based on the result in table1, like this: "SELECT a.name, a.type, a.color, b.(a.type) " and this isn't working also.
View Replies !
View Related
Index Every Id Field In Each Table?
Right now I have 8 tables, and I was told it is best practice to put an index on anything you will be querying a lot for. I will be querying the table a lot based upon the id field, is it a good idea to put an index on each id field to speed up the process?
View Replies !
View Related
|