Ereg String Starts With Number
Does anyone know the ereg syntax for MySQL to return results that start with a number?
E.g.
ereg('[0-9']*, $string);
but for an SQL statement.
View Complete Forum Thread with Replies
Related Forum Messages:
Starts With A Number
Is it possible in a query to select all the records that have a number (as opposed to a letter) as the first character in a particular field? If so, how would you word the query
View Replies !
Number Of A Certain Word In A String
example: i want to search for the word "word1" on this string: "word1 test test test string2 word1 string3 word1" The result should be 3 since there were 3 "word1" on that string.. Its like returning the number of words that that string have, this string of course is stored in the database.
View Replies !
About Substring(string, Number)
myTable1 n city 1 Tokyo 2 New York 5 Peking 6 Nagoya 7 Paris 41 Chicago myTable4 param c=4 c=2 n=41&k=5 c=1 n=5 c=2 c=2 n=1&cate=6 c=2 n=7 c=1 I have data in myTables like the above. The following code produces the following result. code select city from myTable1 join myTable4 on substring(param,3)=myTable1.n where left(param,1)='n' order by n result Tokyo Peking Paris Chicago I like to know why Tokyo and Chicago are retrieved. In my think, Peking which has "5" in the column n is retrieved because there is n=5 in myTable4. Paris which has "7" in the column n is retrieved because there is n=7 in myTable4. But Tokyo which has "1" in the column n is retrieved although the substringparam,3) value "1&cate=6" is different from 1. And Chicago which has "41" in the column n is retrieved although the substringparam,3) value "41&k=5" is different from 41.
View Replies !
Starts And Ends
--Apple-Mail-2-720579055 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed when I enter: cd /usr/local/mysql sudo chown -R mysql data/ sudo echo sudo ./bin/mysqld_safe & mysqld starts and ends. I am using a Mac with OSX 10.2.4 and have installed 4.0.4 Any assistance would be greatly appreciated! Helen --Apple-Mail-2-720579055--
View Replies !
Field Starts
How do you do a search for checking if the field starts with a certain value. What I am trying to do is search article titles for titles that start with "a" or "b" or "c" etc. Basically like on websites where you can find products by clicking on a list of letters. Do I need to grab all the articles and manually check this or can I do this in MySQL?
View Replies !
Insert 'http://' Where Row Starts With Www.
I need to insert "[url]http://"[/url]; to the beginning of each row where a URL has been entered as www.anything.com (for example) to the row becomes (http://www.anything.com) I don't know how I can do this without over writting all the current URL's with out the prefix "[url]http://"[/url]; in a URL and whether it can be done.
View Replies !
Auto-increment Starts On Highest Value
When this has been created, the ID has been generated to 2147483647 and when I try and create another record it fails because nothing can go higher than 2147483647 (I think) The auto-increment has been started at 2147483647 no idea why, and from there when I atmysqlt to create another record it will fail because it ascends from that value.
View Replies !
Mysql Starts Multiple Php-instances
i have a little problem with a server, running mysql and php. I don't know which php-version i am working with, but the following is the answer for 'mysql --version' mysql Ver 11.18 Distrib 3.23.52, for suse-linux (i686) I know, that this version is not the newest one, but thats not my business. My problem is that i need to execute a script, which starts mysql with this command: mysql -hlocalhost -uuser -ppass db < $update > $update_log whenever this command is running and the 800k $update file is working on the db (a lot of delete and insert statements) there are several php-instances created. So many that they are slowing-down the server, that he is unusable.
View Replies !
Using UPDATE To Insert A String Into String
Is there a way/function that will insert a string into another string using UPDATE? for example: I have a 'text (string) column' where I want to add '/' after every 4 characters. hex1hex2hex3 into hex1/hex2/hex3/ I was looking at the substring command, but it can only be used with SELECT?
View Replies !
How To Add Count Number Of Words With Showing Limited Number
SELECT SUBSTRING_INDEX(classDescription,' ',13) as classDescription, listing.inv_company, listing.inv_addr2, listing.inv_state, listing.classcatid, listing.industryid, listing.listingID, listing.inv_country, listing.adscreation_date
View Replies !
Formatted Number Column Cannot Be Sorted By Number
Columns come in and are built based on XML doc and the HTML (smarty mysqllate) does not know weather this is a number to format it nicely such as 2345.993 to 2,346.99. So I do my formatting in the XML which gives the dynamic query developer something similar this: FORMAT(price * qty,2) AS sales All was fine and dandy until i wanted to sort it by number. Turns out Format makes it as string and it does a string sort, in other words it would sort it like this: 1223 21 90 So a genius (/sarcasm) told me to "add a zero" to it and it would work. it turned 2,345.00 into 2.00. (had to explain to the client why his biggest sale was showing up as 2.00) Now i've converted it to ROUND() but is there any other way to have the comma (thousands delimiter) as well has have mySQL treat it as a number?
View Replies !
How Do You Replace A String With Another String
How do I write a query in myPHP admin to search through a particular field in a particular table for a string and replace it with another string? The string is only a part of the value of that field. For example, how would I change "Hello there" to "Hi there"?
View Replies !
String In The Database
Can i have a MySQL query which checks the table containing a list of names? I might have the following names on the table Sony Compaq Logitech Cabinet Fedora Angel Incident Can i get the results using the query for sounds like?? select name from table where name sounds like "sonny" This should pick up Sony.. and a query like select name from table where name sounds like "Kompaq" This should pick up Compaq. This is possible in MSSQL and Oracle. Is it possible in MySQL?
View Replies !
Index By END Of String
for example, if you have a list of email addresses, searching for something like '%@yahoo.com' would need to do a full table scan. why doesn't mysql offer a feature where it indexes by the END of the string, so we can do these types of searches efficiently? an index for email addresses of length 3 would only contain the last 3 chars, but it would still be a useful index type.
View Replies !
Nearest String
I'm trying to perform a search that I can't find any information about in MySQL's manuals, discussion groups, or on the Web. I'm used to using BerkeleyDB's Btree, so I can browse to find the alphabetically next match against a query. If I query "faction" in a BDB btree database and use DB_SET_RANGE as one of the parameters, I can get "fiction" as the next closest higher match. I cannot figure out how to simulate this in MySQL. Do I need to create a BDB table? (Also, I'm using pre-compiled binaries of 4.1.3 for Linux i386 -- I don't see BDB as a table option.)
View Replies !
Convert String
I have a database with records that contain a string date field in the following format: 22 jan 2005 15:02:22 GMT Any way I can have MySQL format that to a timestamp or other date format which I can use to calculate with? (need to flush records older then a certain date)
View Replies !
Append String
Is it possible that when I click a link or something, a text string is appended to some text field? Please tell me how to implement it?
View Replies !
Insert A String
may i know how to insert a string which contains double quotes? for example ,this may not works: insert into string values(" this is my "name" ")
View Replies !
String Functions
Not sure if this is a MySql mistake, but it seems to be. I am trying to execute a query that returns all the records where the first 3 characters of the username are equal to "cd-". After many successive, frustrating combinations of different string formatting / comparison functions, I figure I need some help. Here is my code. $sql = "SELECT username, officer1, officer2 FROM login WHERE SUBSTR(username, 0, 2) = 'cd-'"; here is my error Parse error: parse error, unexpected T_LNUMBER on line blah.. blah.. My questions are as follows... 1. I know the code doesn't work, but is this a legal use of the SUBSTR() function. If so... will it (hopefully not) modify the contents of username? 2. In a previous version of this code i used LIKE intstead of =, without the SUBSTR(). Can anyone explain to me how the 'wildcard' characters % _ work. The manual was vague at best.
View Replies !
Output String
there is a function called "print" in SQLServer 2000, which returns a user-defined message to the client. and the message is returned as an informational error in ADO, OLE DB, and ODBC applications. s there such a function in MySQL to output a string to client also? i've searched the Docs but i did not find any thing like this.
View Replies !
Search For String
I have a field called "contact" .I would like to search for the numbers, "3345". In this field the users were typing "C3345","CUS3345", or even "C 3345". In other words I just need to find the records that contain 3345 somewhere in the string.
View Replies !
String Between Two Strings
Problem: I don't know the length or were a sub string is. I do however know what its in between: '.net/' and ' " ' Question: Is there any way to get this string then remove it?
View Replies !
String Date
How does MySQL keep internally date or datetime? according to the local(server) date and time? or according to GMT? Can you select a time zone in which you want to keep your "date" or "datetime" in database? If yes, where and how? I would like to know that because I might need to change my host provider (meaning movig from Pacific Time zone to Eastern)
View Replies !
String To Rows
Is there any quick way to update the table rows with the comma separated values? For e.g. 'amar', 'akbar', 'anthony' The above string values should be inserted into a table in rows
View Replies !
String Datatype
I have a column datatype is varchar(255), I want to put in <img src="..." width=xx height=yy> to stored in this column, it won't let me, if I put in img src="..." width=xx height=yy (without the greater, less than symbol) it is OK, wondering I have to change this column datatype to something else, maybe text?
View Replies !
String With 6 Chars
i have colums with FULLTEXT keys, and performing search by selecting from table with MATCH AGAINST. Now, my ft_min_word_length is set to 4 (and my provider "can't" change it). I understand i can't search for words with length less than 4, but why doesn't mysql server consider "AB-123" as word with 6 chars. I have entries in my table like, "AB-123", and let's say "AB-1234". if I search for "AB-123" it returns nothing, if i search for "ab-1243" it select right row
View Replies !
Efficiency Of String Vs Int
Is the difference in efficiency of a string in mysql vs the efficiency of an int drastic enough to avoid using an int? I'd like to use strings for readability of types but I can just as easily use ints like a C enum.
View Replies !
Format String
I have a large text file that I need to format so I can use a mysql command to populate a blob cell. Is there an insert comand what will take my txt file and insert it into a cell from a remote computer?
View Replies !
Inexact String
I've been looking for a way to match up search queries for music against a database and am evaluating MySql. Now it looks like Full-Text indexing takes care of issues such as finding results for The Beatles if the user passes in a search string of "Beatles" My question is if MySql has some sort of Sound-ex like algorithms to also find results if the search query was "Beetles" "Beatlles" and things like that. I was told (but have not verified) MS-SQL's full-text indexing provides this feature somehow.
View Replies !
Incorrect String Value
while length(trim(mytext)) > 0 do set var1 = SUBSTRING_INDEX(ltrim(rtrim(mytext)),' ', 1); set pos = pos + 1; set textlength=length(var1); set mytext= SUBSTRING(trim(mytext), textlength+1); insert into pddt values(doc_id,pos,var1); end while; When this loop runs i encounter this error "Incorrect String Value". I was checking each and every line in this loop and found out that substring_index is causing this error(I Believe). Mytext va
View Replies !
Converting In To String
I have a table that has a field, subscription_id that is an unsigned long, and an account_number that is a string. I want to set the value of acct_number to be equal to the subscription_id converted to string form.
View Replies !
String Comparisons
can someone please tell me where this statement evaluates true select 'C:Documents and SettingsJudyVMy DocumentsDSC02062.JPG'='C:Documents and SettingsJudyVMy DocumentsDSC02072.JPG' and how do i get it to evaluate false.
View Replies !
Split String
i m new user of mysql.i need help in a program which break string where ever there is blank space. For example. "Rahul kumar Ranjan". then MySQL should break it and arrange it in following form.. 1. kumar Rahul Ranjan 2. RAhul RANJAN kumar 3 ranjan rahul kumar 4. 5. 6.
View Replies !
Remove From String
I'm looking for some way to remove a part of a string from a table. I have a table with a field called id. It contains data like this: ;1;6;9;34;54 What i want to do is to be able to remove ie. ";34" from this data, kind of oppisit of CONCAT. Hope that I explain myself well enough. Do I have to extract all data, remove the substring and save the data in the db again, or is there an easier way?
View Replies !
Backslash In A String
backslash is usually used as an escape marker in a string. but when I need the backslash as a real backslash, for example in paths, how can I write them?
View Replies !
String Search
I am trying to port my application from SQLite to MySQL database. I believe MySQL by default searches string in case insensitive manner while using '=' and 'like' operators in SELECT statement. I have changed the default collation of the MySQL server to ''latin1_general_cs" from "latin1_swedish_ci". After doing this, the string search is case sensitive for both '=' and 'like' operators. But I would like to search string by case sensitive in '=' operator and case insensitive in 'like' operator (as SQLite does).
View Replies !
Parsing String
i have a string column which has data like "234,312321,2311123,313,3134" in each cell. The thing i wanna do is to write each integer in this row to a seperate cell.
View Replies !
Compare Var To String?
How do I compare a var to a string? eg: SET @comparison = 'xxx'; SELECT status into compare FROM test WHERE id = 1; IF compare = @comparison THEN UPDATE test SET status = 'xxy' WHERE id=1; ELSE UPDATE test SET status = @comparison WHERE id = 1; END IF; It doesn't seem to work.
View Replies !
Comparing String To Int
I would like to know what is the performance behavior in reading an writing string and int in several database tables. What i should use in terms of performance, int or string?
View Replies !
String Operation
If i store a comma separated string(1,2,3,4) in a varchar field.Is there any operation using which i can retrieve the valuse 1,2,3,4 individually an use them in another query.
View Replies !
Using An Apostrophe In A String.
Is there a way to pass an apostrophe from a webpage to a MySQL TEXT column? I have an area on my site where users can update their project details and I can foresee running into problems with the usage of apostrophes. I understand the error is in passing the INSERT command: *** "INSERT INTO projects VALUES('1', '123456', 'Some Client', 'These are the project's details', 'Project Leader') ... *** I understand that MySQL is thinking I mean to close the variable with the ' in project's.
View Replies !
Selecting String
I am having a problem on selecting strings in mysql. I have the folowing column: |////////////////////////////////A\\\\\\\\| +-------------------------------------------------------------------+ | 1A11B01C01D11E12A12B02C02D12E03A03B03C03D13E2 | +-------------------------------------------------------------------+ What I would like to do is get this string giving a letter. Example: I want letter B, then the result should be this: 1B02B03B0. Got it? I give the letter and it returns me the prev char, the letter, next char. Only. Can mysql do this?
View Replies !
|