hi,
i tried to execute following query in php script.
$db_selected = mysql_select_db("lumiinc1_sndemo1", $con);
if ($db_selected) {
echo "database connected";
}
else
{
die ("Can\'t use db : " . mysql_error());
}
$sql = "INSERT INTO `markers` ( `name`, `address`, `lat`, `lng`, `id` ) SELECT `name`, `street`, `latitude`, `longi...
Hi,
I need mySQL timestamp for start of current week or any given date, if week starts with monday?
I'm trying something like:
SELECT UNIX_TIMESTAMP(CONCAT( DATE_SUB(CURDATE(), INTERVAL WEEKDAY(DATE_SUB(CURDATE(), INTERVAL 7 DAY)) DAY), ' 00:00:00')) as start
...
I have a table with 2 columns: integer and var char. I am given only the integer values but need to do work on the var char (string) values.
Given an integer, and a list of other integers (no overlap), I want to find the string for that single integer. Then I want to take that string and do the INSTR command with that string, and all th...
I have two seperate tables:
Table1 - id, news, date_added
Table2 - id, news, extra, date_added
Is it possible to query both table and extract data ORDER BY date_added
Thanks
...
Hi,
I have a database with only one table as below:
userurltag(id,userID(string),Url(String),tag(String))
I want to delete users that have less than 3 urls associated with them.
How can I do that?
...
I need to find the category id in the products table below. However the cms_ecom_categories.id is wrapped with the & character like &12&. Is there some kind of wild card i could use to wrap around? like %cms_ecom_categories.id% ?
$sql = "SELECT * FROM cms_ecom_products, cms_ecom_categories
WHERE cms_ecom_products.pCategories...
i have below table
it_id item_id item_name
1 ite_1 shirt
2 ite_10 pant
3 ite_11 socks
4 ite_12 shoes
5 ite_13 belt
now i need to change item_id with with ite_(value of it_id of that row)
means if it_id=x then item_id should be ite_x and so ...
Measured performance on key partitioned tables and normal tables separately. But we couldn't find any performance improvement with partitioning. Queries are pruned.
Using MySQL 5.1.47 on RHEL 4.
Table details:
UserUsage - Will have entries for user mobile number and data usage for each date. Mobile number and Date as PRI KEY.
UserPro...
If I have two tables in mysql that have similar columns...
TABLEA
id
name
somefield1
TABLEB
id
name
somefield1
somefield2
How do I structure a SELECT statement so that I can SELECT from both tables simultaneously, and have the result sets merged for the columns that are the same?
So for example, I am hoping to do some...
Ok, this is probably really simple, but I just can't figure it out. I have a primary key in a table that goes from 1-5,000. I need to manually update that id (for other table update purposes) so that it says 5,000-10,000. Can't I manually update this column? Please help!!! Thank you
...
I have a list of tags in a database.
Ex:
villan
hero
spiderman
superman
superman
I wanted to obtain a sorted list of the tag names in ascending order and the number of times the unique tag appeared in the database. I wrote this code:
Ex:
SELECT hashtag.tag_name
, COUNT( * ) AS number
FROM hashtag
GROUP BY hashtag.tag_...
I have a table, whose fields are
id, name, link
the link holds the name of the page like "link" = "index.php". Now I want to update this field
and add "page=" in front of "index.php". Using this method I would like to update every entry in my table.
My desired SQL syntax need to be something like this
UPDATE mytable set link= 'page=...
i have a table
table_movie
mid muid actor_name movie_list(varchar)
18 act_6 tom hanks mov_18,mov_19,mov_2,mov_22,mov_23
21 act_9 jhonny depp mov_1,mov_10,mov_20,mov_22,mov_3,mov_9
28 act_16 bruce willis mov_18,mov_19,mov_2,mov_22,mov_23
29 act_19 jhon trovolta mov_1,mov_10,mov_...
I'm just wondering if there is a more efficient way of doing this.
I have a table in which I track users scores for different flash games. The table games_scores is defined like this:
Each user can have multiple entries for any game in this table. When I display the score board I only select the MAX score fore every user. Nothing fan...
i'm having 2 tables: members and comments.
I select all members, and then join comments.
But in comments I'm selecting some SUM of points, and if user never commented, I can't get that user in listing?!
So how to select default value for SUM to be 0 if user never commented, or some other solution:
SELECT c.comment_id AS item_id, m.memb...
This query was working fine when the database was small, but now that there are millions of rows in the database, I am realizing I should have looked at optimizing this earlier. It is looking at over 600,000 rows and is Using where; Using temporary; Using filesort (which leads to an execution time of 5-10 seconds). It is using an index...
Hi I am a newbie to mysql
Here are my questions:
What is the use of Mysql Index key?
Does it make a difference in mysql queries with defining a Index key and without it?
Are all primary keys default Index key?
Thanks a million
...
I am using nested sets to represent a tree in mysql, like so:
Tree
ID
title
lft
rgt
Given the ID of a node in the tree, what is the easiest / best way to UPDATE that node as well as all of it's ancestors?
For example, let's say that the node ID (36) is 4 levels deep in the tree. I would like to update its title, as well as every par...
I am getting this error when I pass an invalid SQL string... I spent the last hour trying to find the problem assuming - It's not my SQL it must be the db handle... ANyway, I've now figured out that it was bad SQL...
What I want to do is test the result of the mysql_query() for a valid resultset.
I am simply using empty($result)... Is ...
I have to make a design decision with regards to fields in the database.
Given:
users table
Problem:
Visually we have a check box that says:
[*] check this box to not show this again
Should this data(boolean) be saved in the users table in a column or in a new joint table that has the user_id?
Which one scales better? faster?
...