Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MYSQL


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





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 Complete Forum Thread with Replies

Related Forum Messages:
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 !
Id Starts From 1 After TRUNCATE
is it possible to let the id of a table to count from 1 afted it's been truncated?

View Replies !
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 !
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 !
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 Replies !
Mysqld_multi Don't Starts Groups On Linux RedHat 9
mysqld_multi doesn't start the two groups if I gave this command imediately after stopping them.

View Replies !
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 !
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 !
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 !
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 !
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 !
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 !
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 !
Copying A Field Content To A Range Of Records Same Field
I have to copy the content of a Binary field to a range of table same fields? What query should I run?

For example I have to copy fild5 of record 159788 to records 2000 to 2800.

View Replies !
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 !
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 !
Rules For Field Names And Field Length?
I have searched around a bit but have not found whether there exist some rules how to name fields (length, special characters, numbers etc.) and which field lengths are to use. I am looking for some "official" guideline or so.

Can anybody help?

View Replies !
Store Arrays In A Field Where The Field Is In A Relationship?
Can you store arrays in a field where the field is in a relationship?

View Replies !
Orderby A Text Field As It Were An Integer Field
Is it possible to construct a query so that the orderby 'field' returns the rows as though the 'field' were an integer field, even though it is a text field? I do not want e.g. 10 to be before 2.

The field in question is called 'lagerantal' and is of type 'text'

View Replies !
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 !
Creating Field In Table To Sum Field Values
i was wondering if there was a way in mysql to have one record that will sum up all each field value(one record with each field having sum totals)? i have a table with over 60 statistical fields that i want to get the sum for.

View Replies !
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 !
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 !
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 Replies !
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 !
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 !
Copy Partial Field Value To New Field
I have a table with state and county in one field. The first 2 characters in all the records indicates the state. Is there a way to copy just these first two characters into a new field in mysql?

View Replies !
I Want Field Data Without Field Name, How?
I am retrieving data from mysql under linux. something like mysql -e
"select id from table1", I get output

id
1
2

but I dont want the field name "id" but only the data. How can I do it?

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 !
Set Dynamic Value Of A Field To Another Field
I need to create an field for an "alias id". Basically they have this content managed navigation system where if your on a certain page it shows the link in the navigation column as "active" or highlighted.

when the user clicks on the "header" link - something like the Discussions or Forums link at the top of this page.

For some pages the "header" links don't have an actual page assigned to their page_id and some do.

In the case where they do, I need to have a column which stores their actual id and then the one they're linked to.

?id=84 should look the same as ?id=85 where ?id=84 is a "header" link

View Replies !
Field Contains Form Field
I have a form putting variable search_var

Select * from training.itdtms_content where content_Body like #search_var#

the # on each side are for the Coldfusion variable.
I want to be able to find records that have a search term inside them, can anyone help?

View Replies !
Using A Field Alias In Another Field
I'm migrating a DB from Access to MySQL and I having problems with queries similar to this:

SELECT 1 AS x, x+1 as y;

I get a "ERROR 1054 (42S22): Unknown column 'x' in 'field list'" error.

Is there a way to do this without calculating 'x' twice?

View Replies !
Having Field = MAX(Field) Not Working
I have two tables, one titled "a_thThreads" and one titled "a_psPosts". There can be many posts in one thread. I would like to be able to pull a list of threads with the information from the first post in each thread, as well as the last post in each thread. It works when I try to do the first posts. However when I try getting the last posts, I get an empty recordset.

Here is what I am doing to get the first post (and this works):
SELECT thThreadID, psPostID
FROM
a_thThreads, a_psPosts
WHERE psThreadID = thThreadID
Group By thThreadID
HAVING psPostID = MIN(psPostID)

Here is what I am doing to get the last post (returns empty recordset):
SELECT thThreadID, psPostID
FROM
a_thThreads, a_psPosts
WHERE psThreadID = thThreadID
Group By thThreadID
HAVING psPostID = MAX(psPostID)

Any thoughts?

View Replies !
Field 1 Greater Than Field 2
i have a table which contains 2 date fields. so i need to display records where date1 is greater than date2. how do i do this in mysql.

View Replies !
SELECT * WHERE Field NOT IN ('field ')
I am trying to get all records except a particluar record.

I have got it to work, but if i try to order it by id or something, it goes tits up.

SQL Code:

SELECT id,title, content, user, DATE_FORMAT(date, '%d/%m/%y %H.%i') AS date FROM services WHERE title NOT IN ('Welcome!!') ORDER BY id ASC LIMIT 1, 4

View Replies !
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 !
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 !
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 !
Date Field, Time Field, Sort By Date And Time
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) on the fly and to be able to sort the query results on the resulting field.



View Replies !
Same Field
I had a normal KEY INDEX on one VARCHAR field
I then added a FULLTEXT KEY to the same field.

I wonder if I should now remove the normal KEY INDEX
as obsolete or leave it? Can I expect the FULLTEXT index
to behave just like normal KEY index (if using without
the match operation)? Would there be some performance
difference in this respect?

View Replies !
Can I Use ALL As A Field Name?
I have a table that has the 3 letter currency codes of the world currencies
as the field names. The Albanian Lek currency is know as ALL. When I goto
save to this field I get an error presumably because it is a word used in
MySQL. Is there anyway to store/read to/from this field keeping ALL as the
field name - without generating an error?

"INSERT INTO a_currency_exchange_gbp SET
AED='$aed_gbp',
AFA='$afa_gbp',
ALL='$all_gbp',
AMD='$amd_gbp',
ANG='$ang_gbp',
AOA='$aoa_gbp',
etc

View Replies !
Field More Than Once
I need to query a field more than once in an SQL statement using standard SELECT field and SELECT CONCAT(field), for instance:
Code:


SELECT
news.id,
news.subject,
CONCAT('<a href="',news.id,'">',user.name,'</a>')
FROM
table...

mySQL won't let me call the news.id field more than once, though. Can anyone help me? I thought the solution might be along the lines of SELECT news.id AS sql_id,CONCAT('sql_id',username,'...').. but this produced an error.

View Replies !
Particular Field
I will delete a particular value ( address to an image) in a field, but my code doesn’t work. Here is the code:

if(isset($tabort1)){
$sql="delete image from sidor1 where id="$pageid"";
$rs=mysql_query($sql, $conn);
}
The if statement execute and I get no error messages, but no deleting takes place. What am I doing wrong?

View Replies !
Field Like And Like?
i search google for sql field like and didn't find anything about field like. i need to know what is the difference between field like and like

View Replies !
Field Value As Field Name
is it possible to use the value from one table row field as the field name for another table, within one query?
ex:

select t1.fieldname from t1, t2 where t2.(t1.fieldname) = 'whatever'

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved