MySQL Uses Only Part Of The Key When I Add An OR
I'm trying to understand why MySQL isn't using all parts of the primary
key when I add in an OR statement in the query.
I have a people database, and a distances database. The people database
lists a person's name and their location, the distances database
contains the distance between any two points in the country. There are
an roughly 15000^2 entries in the distances table, and currently about
100 entries in the people table. The schemas are as follows: Code:
View Complete Forum Thread with Replies
Related Forum Messages:
Use MySQL As Part Of A Web Page
I would be interested in hearing opinions on how easy or difficult it it to use MySQL as part of a Web page. I have no experience with MySQL, but I have experience with MS Access and VB. The project that I'd like to put together is an online ordering facility for videotapes, not too many concurrent users and relatively low volume as these things go. I am also interested in how one would go about integrating the MySQL database with a site constructed with MS FrontPage (2000 or 2002).
View Replies !
MySQL As Part Of RedHat 9 Install
When I did my RedHat9 install, I choose Workstation and customized the packages I wanted install. As a part of that customization, I chose mySQL DB; however, I can't seem to find any RedHat documentation that says how to get to these installed packages. I would like to just start using them, but not sure where to start. Any hints to get up and going quickly?
View Replies !
Editing Part Of Field In MySQL
I exported an excel database with no number formatting to a comma delimited txt file and imported it into mySQL. The database contains 24000 rekords. For some reason some 3000 odd rekords were imported with .00 decimals. Is there a way through a SQL query that I can delete ONLY the incorrect .00 data from multiple fields? I don't exactly look forward to manually editing 3000 rekords!
View Replies !
Extract Specified Part
In one of my table, I have a date type field in format 0000-00-00, in my php syntax, how can I extract the year part only? i.e. only 2005 from 2005-07-08. I searched the help from mysql reference, but too tired for me now
View Replies !
Restoring Part
I've got a backup of all the databases on my server, which includes databases from a number of different users. How do I restore the backup for only one specific user (ie only restore his databases from the backup file)
View Replies !
Showing A Brief Part
I am wondering is there a way to show a brief part of an article? If so how? Maybe up to about 50 words. Should this be posted in the php forum? If so can someone please move it?
View Replies !
Uniqueness On Particular Part
how can i specify that a particular part of a string say from position 3 to 8 must be unique in the table Code: create table temp (a VARCHAR(25) primary key, b varchar(25), unique(b)); now thing is that i dont want all the column value to be unique for column b, just a part of this value must be unique
View Replies !
Replicating Part Of Database
I'm in need of creating reporting database. What I have to do it is to replicate only half of tables to next database so reports could query only that second database. Unfortunately there is too many inserts in existing database so simple master/slave solution won't give me much. I was wondering if there is a way to replicate just few tables? Can I use for it mysql replication or do I have to create manually scripts to do that? I expect that reporting servers is a typical way to report off of transactual systems
View Replies !
Importing Part Of A Database
I have a MySQL database and I want to cut and paste a part of it into my current MySQL database. Is there a certain place that it has to be cut ? Here is a sample of the data, can someone tell me where I start the cut. # # Dumping data for table `category` # INSERT INTO `category` (`id`, `name`, `pid`, `fset`, `weight`, `image`, `descr`) VALUES (8, 'Boat Parts & Accessories', 237, 'miscellaneous', 0, '', ''), (3, 'Exercise Equipment', 21, 'miscellaneous', 0, '', ''), (4, 'Autos', 0, 'auto', 0, ', 'Cars,Trucks,Vans,Parts & Accessories'), (5, 'Motorcycles', 0, 'motorcycle', 0, , 'Motorcycles, Scooters,
View Replies !
Reading Part Of An Entry
I'm on a crash course learning PHP and MySQL and I'm doing pretty well for the amount of time I've had to learn them; however I'm a little stuck on a small thing. I have a database field which is set to take 8 alphanumeric characters, however I want to do a SELECT procedure that takes just the first 4 alphanumeric characters. Is there an easy way to do this?
View Replies !
Replace Part Of String
I want to replace all /thiswebsite/ to /otherwebsite/ in a field called "url" of a mysql databasetable that for example contain: /thiswebsite/link_to_page1/subpage1 /thiswebsite/link_to_page2/subpage1 /thiswebsite/link_to_page1/subpage2 So with a query i need to replace /thiswebsite/ in all records where the "url" field starts with /thiswebsite/ to /otherwebsite/... The REPLACE function in MySQL does not seem to be suitable since it is made to replace the whole value, and not part of it? I need to do this because I'm working with a friendly url cms. Offcourse people will like to have the possibility to change url's, and therefor i need to change all links to it.
View Replies !
How To Do A Substr As Part Of A Query
I want to select from a table all records where the name field starts with a particular letter such as "a" or "b" and so on... but i cant seem to get the where statement to co-operate with me. this is being done in php (if that matters) and on a linux server. the current part of the query that i am trying (or should i say the last one i tried) is" AND substr(b_name,0,1) = '" . $alpha . "' AND ";
View Replies !
Searching On Part Of Feild
I have database called products with each product having a unique code and some details about the product: |----code-----| product name | product details | | 110 10 111 | 50W heater-- | bla bla bla---- | each part of the code tells some more about the product ie: 110 product group 25 product supplier 254 is the actual part number, but this is repeated at times... I would like to be able to query the database and return only products from a specified supplier of only products in a specified group.
View Replies !
Search By 'part Of' Name When First And Last Combined
I have a database that has the first and last name combined under a single column, I'm trying to search, via a php form, the table for matches. Example: Search term entered 'Charlie' Table contacts contains a column named 'name' which holds both the first and last name. (Charlie Brown for example) Is there a SQL syntax that will allow me to do this? The php form contains a field named criteria. Here is the SQL code I'm using. $sql = "SELECT * FROM contacts WHERE name = '".$_REQUEST['criteria']."'"; If the user enters Charlie Brown it will return a result, if the user enters Charlie it returns no results. Changing the database structure isn't an option so if I have to I'll load the ID and name columns into memory and use php to sort, but I'm trying to save cpu time.
View Replies !
UPDATE With SELECT In WHERE Part
I want to execute this command in mysql: UPDATE alerts SET scenario='1' WHERE alerts.cid IN(select alerts.cid from alerts JOIN data ON alerts.cid=data.cid); but I get this error message, though the syntax seems alright to me; ERROR 1064: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right.
View Replies !
Deleting Part Of A Field
i have a table called, videos, and a in that table i have description fields, that all contain a description followed by {video}randomnumbers{/video} and i want to delete the {video} + {/video} and the random numbers between but leave the other parts of the fields,
View Replies !
Multi Part SQL Strings
1. How can i browse my data base table to see if "category" contains a specific word and then return the results. ex: if a "category" is a table key and contains text, and i want to know if the text contains for instance the word "computers" 2. How can i get sql to return random keys from the category table, for instance i'd like to return 40 random entries in category
View Replies !
Emptying Part Of A Record.
I have a table with over 100 records in it, in which i need to empty out two of the fields for each record. I know how to simply drop and empty the entire table, but how can I empty specific fields for all records?
View Replies !
Changing Part Of Db Columns
I have a problem. I have 15000 in several directories. The location of the image is pointed in the column as http://xx.xx.xx.xxkirkimagejan-jun040012345.gif. I need to delete the http://xx.xx.xx.xx part and then replace the to / where the image file begins....
View Replies !
Accessing Only Part Of A Database Value
I'm currently writing a form where a user will input the first three characters of a postcode. In my database I have registered users full postcodes, but when I run my query I only want to match the from the form to the first three letters of the database value.
View Replies !
Sort By Numeric Part Of A Field
I must sort a table width only one column. Inside the field I have, for example, hard disk capacity (something like '100Gb' or '80Gb' or '80Gbyte' or 'Gb80'). So, if I use ORDER BY ... DESC, 80Gb will be before 100Gb and other errors. How can i sort the table only on the numeric part of the field? I'm trying using CAST() but with no results.
View Replies !
Select Part Of Text Field
I want to get a snippet from a text field. I don't want the whole thing, just the first 200 characters, for example. Is this okay or is there a better way? SELECT title, LEFT(body, 200) as body FROM table.
View Replies !
Update Query For Part Of A Field
I need to update part of a field in around 3000 rows of a table. In each case the field in question has text already in it but I need to add an extra bit of text to the start of each one. I've had a look on the web and have found examples that show you how to replace text in part of a field but haven't found anything about adding new text.
View Replies !
How Do I Update Part Of A String Value In A Field
I have information in a field as follows: |___col___| | AAXXAAA | I need up update all instances of the substring 'XX' in the 'col' field to 'YY', but I do not know how to structure the SET portion of my update statement to do this. Below is my update statement minus the set portion. UPDATE db.table SET col = <need help> WHERE col LIKE '%XX%';
View Replies !
Retrieving By Part Date Sort Of I Think
I have a database (suprisingly) that has a table called "challenges", in this table i have over 12,677 entries (rows) and counting.. each row has a date cell with an entry formatted as such 2006-10-07 03:32:00 Which is year - month - date time im building a new admin system for the site and i cant figure out how to get/sort results by date for example i would like a query that gets results for the last month or i would like a query that gets results for a certain day...
View Replies !
Fulltextsearch: Matching On A Part Of A String
I did a lot of searching but I didn't find a definite answer if it can be done or not. My question is: If I have a table with a Fulltext index on it, am I able to find rows if I search on a just a part of a string instead of searching for an exact word? Example: SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld'); gives results but SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('ysqld'); doesn't. Is there a way with Fulltext and Match to get this working?
View Replies !
Group By Specific Part Of Date
I have a field in a table with the date format. I was wondering if there is a way to group by a specific part of the date instead of the whole date? Meaning I would like to grab all records and group by year in the date column. How can I do that?
View Replies !
Thoughts On Reordering Part Of A Table...
I keep track of the order in a table with field called 'the_order' and it has integers that increment as you add content. However, when I need to reorder a record using a custom CMS I end up moving 'the_order' number to whatever position and UPDATE all items below that up one. Is there a better solution than this? If you end up having 1,000's of records you can tie up the table.
View Replies !
Trying To Write A Two-part Fast Query
The situation is this: there are two tables, one called "objects" (fields: object_id[int] and object_name) and properties (fields: object_id[int] and property_name and score[int]). Objects have one or more properties. In short, what these 2 queries need to ask are "what objects could an unknown object be, given what properties I know?" and "what property should I measure next to most narrow down the possible objects?" The objective of the first query is to return an object who has all of the given properties scored above or below the given value. For example, I might look for the object_id of an object who has the property "green" scored above 3, the property "hot" scored below 2, and the property "bright" scored above 0. It might have other properties, too, but it must have these 3. And then, for the second part, I need a query that will select properties which are NOT in this set of given properties but are relevant to the returned set of objects. In this part, I'm not concerned with the property's score - just that it is relevant to the objects. In other words, this query might tell me that the property "hard" is relevant to 3/4 objects (even though one of them had a very low score for the hard property, another had a very high one, etc). Basically I want to know which new property, once I can determine the score of this new property, will help narrow down the object-set the most, so that I can collect data for the most relevant property to narrow down the object set.
View Replies !
Get Back The Date Part Of A Datetime With A Select
My web site uses the same request, on one hand, to make selections at precise hours, on the other hand, to make selections for day: SELECT thing FROM `table ` WHERE dates = ' 2008-01-01 09:06:40 ' The daily table `table ` contains a column date in the format "date" (YYYY-MM-DD). With my former version of Mysql (5.1.14-beta), all the lines containing date = '2008-01-01' were selected. My problem is that since I've changed my Mysql version these are lines like date = ' 2008-01-01 09:06:40 ' which seem to be selected : so nobody in my daily table... Is it a problem of version of Mysql? Nevertheless my newone version is more recent (5.0.51a-6) than the former.Is it possible to select lines having '2008-01-01' without modifying my SELECT?
View Replies !
Noob: Sql To Select Part Of A Text Field
I have a text field in mysql database. record1: id:1 text_field: apple, oranges, grapes record2: id:2 text_field: grapes record3: id:3 text_field: oranges I need a sql to select records 1,2,3 for word "apple or oranges or grapes" in text_field.
View Replies !
INSERT INTO SELECT Taking Forever But SELECT Part Is Fast?
I have the following mysql code to insert about a million rows. This takes quite a long time (over 50 min). However, when I just run the query alone without the INSERT command, the query itself only takes under 5 minutes. Is there a way I could speed up the inserting?? insert into tblc select tbla.* from tblb inner join tbla on tbla.issuer_id = tblb.issuer_id;
View Replies !
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 !
Error : "cannot Be Part Of FULLTEXT Index"
in order to make it possible to do a fulltext search on multiple columns I created a temporary table which holds all the fields I want to search in from different tables. I'm creating a temporary table, create an fullindex on it, search in it, drop it. On our local server this works fine. But when I perform the code on the server of our client I get the following error message: "Column 'manufacturertitle' cannot be part of FULLTEXT index" This is caused by: "CREATE FULLTEXT INDEX full_index ON SearchTemp(producttitle, description, description2, manufacturertitle );" In the original table the field 'manufacturertitle' has the following properties: Type: varchar(255) Collation : utf8_general_ci Null : Yes I found the following solution somewhere but I have no to clue what to do now: "As of MySQL 4.1.1, full-text searches can be used with most multi-byte character sets. The exception is that for Unicode, the utf8 character set can be used, but not the ucs2 character set.".
View Replies !
Update Part Of Column Into Another Column
I'm looking for a way to update a SQL column with a portion of info from another column in the same table. example of a sql command -------------------------- UPDATE table1 SET table1.columnname1 = table1.columnname2 FROM table WHERE blah blah blah Here's the thing... I only need a portion of the data found in the source column. I'm not sure how I would do this then. for example, the database has countries and states combined into one column like this 'US-DC', 'US-CA', US-FL', etc. I want to separate these into two columns, a country column and a state column.... and I dont want to go though all the results and do this line by line. How would I write the SQL command so that it puts just the country in the country column, and puts just the state in the state column, and it omits the dash all together. any ideas?
View Replies !
Index, Then Query On Only Part Of The Index
Lets say we have a fulltext index on... column 1, column 2, and column 3 If we do a select statement matching only on column 2 and column 3 will the index still be used effectively? Do we then need a second index only on column 2, and column 3? Would it be smart to simply create indexes on all of the following? column 1 column 2 column 3 column 1, 2, 3 column 2, 3 ?
View Replies !
Part Of A Field Into Another Field
I have a table with an email field that contains values of the form uid@domain. I need to populate a new field called uid with just the uid part of the email address. Is there any way of using select to just retrieve the part before the @ and insert it into the uid field?
View Replies !
ERROR 2002 (HY000): Can't Connect To Local MySQL Server Through Socket '/var/lib/mysql/mysql.sock' (13)
I have a problem connecting to sql and can't find anything on the net to solve the problem. I have some sql databases running on a server. when I'm root on the server and I want to login to sql I do "mysql -ustudent -p -Dwordnet30 and it works fine. when I'm logged in with the user account on the server, i get this error message: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13) so with the same user name in mysql, i can log on when i'm root, but not when i'm the user. the grant table for the user looks like this: Code:
View Replies !
Can't Connect To Local MySQL Server Through Socket '/home/data/mysql/mysql.sock' (13)
I just installed mysql on linux. If I open a terminal, su to root, then type "mysql", I am able to connect to the server and run my queries. If I exit out of su so that I am my own id (baisley) and type "mysql", I get this error: Can't connect to local MySQL server through socket '/home/data/mysql/mysql.sock' (13) Any idea why? mysql.sock has full permissions (read/write/execute), so it should be accessable by user baisley. If I am baisley and I run "mysql -u mysql" (as mysql is the user that the RPM set up), it will connect. What I would like to be able to do is run this without having to be user mysql all the time. How do I go about setting that up, or is it better to run all my queries/make tables as 1 user?
View Replies !
ERROR [HY000][MySQL][MyODBC 5.00.11][MySQL] 2006 MySQL Server Has Gone Away
Hosting Package Environment: ASP.NET ver 2 MySQL 5.0 FP Extensions 2003 Progression: Developed Website Outline Developed Database in Access2003 Migrated AccessDB to MySQL @ Hosting Service using Migration Tool. Can connect using MySQL Admin tools and run queries fine and all data, relations etc. are there. PROBLEM: (The heart of the matter) Starting simple, created GridView Control using Microsoft Visual Web Developer 2005 Express, a few glitches here and there, used the MySQL Connector/ODBC v5.00.11 followed instructions. Can see database in Database Connections Window but when I try to connect the GridView Control to it I get: "Database schema could not be retrieved for this connection. Please make sure the connection settings are correct and that the database is online. ERROR [HY000][MySQL][MyODBC 5.00.11][MySQL] 2006 MySQL server has gone away" Had thought that "Microsoft Visual Web Developer 2005 Express" might be messing with the ODBC driver so thought to download the .NET Connector. That's when it all went bad. The documentation does not say how to install or use the connector or where to put the files. It seems to assume that these bits of information are common knowledge and I suppose that if I had kept up with the technology it might be. But alas I didn't and it Isn't and It Don't work.
View Replies !
Could Not Load MySQL Driver! Compile Php --with-mysql Or Install The Mysql.so Module.
I am trying to install Media Wiki 1.5.2 on Windows XP and I have already installed apache_2.0.55-win32-x86-no_ssl ,mysql-5.0.15-win32 and php-5.1.1-Win32 . When I am trying to install Media Wiki 1.5.2 I receive the following message : Warning: dl() [function.dl]: Not supported in multithreaded Web servers - use extension=mysql.so in your php.ini in C:Program FilesApache GroupApache2htdocsmediawikimediawiki-1.5.2install-utils.inc on line 17 Could not load MySQL driver! Please compile php --with-mysql or install the mysql.so module.
View Replies !
Can't Connect To Local MySQL Server Through Socket '/var/lib/mysql/mysql.sock' (11)
We run Bitrix CMS and upon installing the web statistics module, it will sometimes show this error: Error! mysql_connect('-', '-', '-') Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11) The max connections has been raised to a 1000... and SHOW GLOBAL STATUS says for the maxed used connections: Max_used_connections 273 The server does not really max out...
View Replies !
How To Configure MySQL ODBC Driver To Connect To A Mysql Server On My Own Side Of The Router?
Using MS Access, I have attached to MySQL servers in other states and other countries on the other side of my router. But when I use the MySQL ODBC driver 3.51 to connect to a MySQL server on my own LAN, the driver tells me it cannot make the connection. Here are the ODBC driver connection parms: Data Source Name: (free field - name my "my linux box" will do nicely) Host/Server Name (or IP) - something like MSQLUserName@ServerName.net has worked fine for me in the past. Now I'm trying 192.168.1.106 Database Name - whatever, mysqldb works fine, any valid db User - root Password - myrootpass Port - 3306 has worked fine 4 me N the past. Dunno whether 2 use now SQL Command On Connect - haven't ever put anything here Perhaps there is some configuration in mysql user privilege for the mysqluser "root" that would prevent him from logging from a remote PC to the mysql server?
View Replies !
Warning: Mysql_query(): Can't Connect To Local MySQL Server Through Socket '/tmp/mysql.sock' (2)
I'm trying to connect to my MySQL database (sitehosted by GoDaddy) using PHP. I am having these errors and don't understand what they mean Warning: mysql_query(): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/content/n/l/a/nladmin/html/v5.0_3/c_register.php on line 6 Warning: mysql_query(): A link to the server could not be established in /home/content/n/l/a/nladmin/html/v5.0_3/c_register.php on line 6 Notice: Query: SELECT * FROM types MySQL error: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2) in /home/content/n/l/a/nladmin/html/v5.0_3/c_register.php on line 6 here4 Warning: mysql_close(): no MySQL-Link resource supplied in /home/content/n/l/a/nladmin/html/v5.0_3/c_register.php on line 13 I've checked paths and connection settings and don't see any problems. My guess is now that the problem is coming from the opening and closing of the DB. my script, c_register.php uses a require_once('../mysql_connect.php') to open the connection to the database. But I also have a function definition in c_register.php that uses require_once('../mysql_connect.php') when called because it needs a connection to the DB. Here's a visual that might help:
View Replies !
MySQL Error Number 2003 :: Can't Connnect To MySQL Server On 'hostname'(10065)
I was running an older version of the query browser a while back to connect to an older version of mySQL (3.0) running on a linux box. The server hasn't changed, but the query browser has been upgraded to 1.1.10. I can't go back to the older version of the query browser because the machine that ran it got re-formatted so I downloaded the new version and installed it. So ... I get the following error when I try to connect: MySQL Error Number 2003 Can't connnect to MySQL server on 'hostname'(10065) Interestingly, I wrote a simple PHP script to connect to the server and pull some data off of it:
View Replies !
|