I have a database (mdb file) that I am currently busy with. I would like to know if it is possible to generate MySQL code that would be used to create this database?
Hi,
Say If I get a resultset in mysql as :
ID count(posts)
101 2344
102 3245
103 232
104 23
Is there any way to get the tota count of count(posts) in the query itself,
like this?
ID count(posts)
101 2344
102 3245
103 232
104 23
------
5844
I have two table in mysql named rootpath with only one field 'root' and savecatogory with fields brandid,categoryid,name.There is no relation between these two tables.Now how can retrieve root,brandid,categoryid using single query.Please help me.
I want to find top rated item using AVG function in mysql, right now my query looks like this:
SELECT a.title, AVG(d.rating) as rating FROM in8ku_content a
JOIN in8ku_content_ratings d ON a.id = d.article_id
ORDER BY rating DESC
Problem is that it takes AVG of all items and the result is not accurate, what should be changed here to get correct result ?
Tables:
in8ku_content [id, title] in8ku_content_ratings [id, article_id, rating]
hello
I'm try to store String (that contain html ) to mysql database by using Longtext data type.
but its always says "You have an error in your SQL syntax".
(note : i tried to store normal text , and its work)
Hi, I'm wondering how I can sort mysql data based on the number of entries.
I'm doing this so I can have a page of the top purchases, so it would have to retrieve all the product_id's from a table, and then sort them by the most times one shows up, limiting it to 10 or something.
Thanks!
You may notice from my last question that a problem caused some more problems here.
My database is now unusable partly due to my interest to break things and my inability to look at error messages. I know that I should not reuse primary keys, but I would like to use them again after the removal of the database that I deteriorated. So
How can you correctly remove MySQL database?
A site has blocked with google.
There is a site for this issue:
http://25yearsofprogramming.com/blog/20070705.htm
How can we detect mysql injection?
Thanks in advance.
I need to convert a varchar value of 1/9/2011 to a date in mySQL and I want only the month and year. So that I can then use the PERIOD_DIFF function (so I would need the above to be converted to 201101).
I've tried various ways using the STR_TO_DATE function:
SELECT STR_TO_DATE(CYOApp_oilChangedDate, '%m/%Y') FROM CYO_AppInfo
But I get weird results... (for example: 2009-01-00)
What am I doing incorrectly?
I got this odd error and I can't figure out where it came from:
Warning: mysql_query(): 3 is not a valid MySQL-Link resource in (...)
What's up with the 3? I don't get it. Has anyone experienced this error themselves?
hey everybody
i'm trying to do somthing simple like this
SET i = 0;
WHILE (i <= 2230686) DO
INSERT INTO customers(check) VALUE(0);
SET i=i+1;
END WHILE;
in the phpmyadmin SQL query box
and it doesntwork and the mysql doesnt throw an understandable reason
any clues ?
Below is my current structure for MySQL database
id | item_name | item_files
------------------------------------------
1 | Item A | file1.zip,file2.zip,file3.zip
2 | Item B | file3.zip
Example I create simple form to fill up Item Name and Multiple upload files then store it to db.
Question :-
How to design the db structure for accept the multiple files?
There have a way which I don't want to use explode, implode to get the file1.zip file2.zip file3.zip
How can I correct the problem I keep getting from the code below which states 'user_id' in where clause is ambiguous. Thanks for the help in advance.
Here is the mysql table.
SELECT user.*, user_info.*
FROM user
INNER JOIN user_info ON user.user_id = user_info.user_id
WHERE user_id='$user_id'
Hi,
Is there any application that will read a MySQL database table and generate a SQL script of INSERT statements (so that I can copy tables from one db to another db)? OR how can I transfer content from db1.table1 to db2.table2 where table1 and table2 is same.
Thank you.
Hi Guys,
I'm building a part of a system where the user can define "views" from a mysql database.
I want some way of generating simple HTML tables/reports from the data, but not just plain output of sql queries- simple joins probably isn't enough.
Any ideas?
I want to group my data by Age and by gender: like this sample data:
Age: 1
Male: 2
Female: 3
Age 1 Total: 5
Age: 2
Male: 6
Female: 3
Age 2 Total: 9
How can I group the data according to age and count all the male and females in that age from mysql database?
I'm trying to make a stored procedure but it doesn't seem to be recognizing the parameters I've given it.
Procedure
create procedure test_pro(IN searchTable VARCHAR(55))
begin
select * from searchTable limit 10;
end //
Trying to execute
mysql> call test_pro('exampleTable');
ERROR 1146 (42S02): Table 'db.searchTable' doesn't exist
It isn't replacing the searchTable with the parameter that is passed in.
hi,
currently i have 2 table in mysql
structure:
messages
id | content | user_id | time
submessages
id | subcontent | msg_id | user_id | time
submessages msg_id is FK for messages id.
Now i need to query from php
$cur_user = $user->current; // current user id.
SELECT * FROM messages WHERE id > '{$_GET['id']}' // problem here
how do i query submessages that posted by others not include current user?
thank you.
How would i monitor a MySQL to detect SELECTs which are running slowly? Having identified a poorly performing SELECT, how would i analyse it with a view to improving it?
Im having a mysql query like this
SELECT group_name FROM t_groups WHERE group_name LIKE '%PCB%';
The results are
group_name
------------
PCB
Full size PCB
Another query,
SELECT group_name FROM t_groups WHERE group_name LIKE '%PCB-123%';
group_name
-----------
PCB-123
How can i use a query that will show all the three results ?,I mean i need to get all the results that starts or contains PCB