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
...
is it possible to connect to an mysql database and issue queries using c++?
i found some sample code from the internet but they all use mysql! so u need to install mysql first on the computer.
what i want is to use a program from different locations where i don't have mysql installed to access a remote mysql database.
is this possible?
...
Insert into Attendancemst
( emp_code, name, date, timetable, on_duty, out_duty, clockin, clockout,
late, early, mis_in, mis_out, absent, halfday, total_time
)
values
(pemp_code, pname, pdate, ptimetable, pon_duty, pout_duty, pclockin, pclockout,
plate, pearly, pmis_in, pmis_out, pabsent, phalfday, ptotal_time
)
ON DUPLICATE KEY U...
Why is it that you need to place columns you create yourself (for example "select 1 as number") after HAVING and not WHERE in MySQL?
And are there any downsides instead of doing "WHERE 1" (writing the whole definition instead of a column name)
...
Yes it's Windows sorry.
I'm using mysqldump with the option -T which creates a sql and a txt file per table.
mysqldump -u user -ppass db -T path
I use that option to be able to restore easily one table.
Now I'd like to restore all the tables.
mysql -u user -ppass db < path/*.sql
Obvously doesn't work
Also, I don't know where do ...
I want to make sure all of the mysql servers have a certain configuration (max_connections>1000, innodb_file_per_table=on) and do regular checks via nagios.
However the nagios plugin check_mysql_query states
Only first column in first row will be read" ... "The result from the query should be numeric
Has anybody an idea how to s...
Hello,
I have a test table. The test table is as follows:
CREATE TABLE `mytest` (
`num1` int(10) unsigned NOT NULL,
KEY `key1` (`num1`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
I inserted 50 million rows in this table.
When I do show table status the avg_row_length is 7. I was expecting to see 4 since mySQL uses 4 bytes for int...
First of, a simplified version: I am wondering if I can create a trigger to activate during INSERT (it's actually LOAD DATA INFILE) and NOT enter records for an RMA already in my table?
I have a table that has no records that are unique. Some may be legitimate duplicates but there is one field that I can use to know if the data has bee...
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
...
Hello,
I am trying to insert data into a mysql table from a csv file. I am using the infile sql command, but I am having trouble because the first column of the table is an id that is set as an auto increment field. what do I have to set my first column value to in order to get this to work, or can I do it at all?
Thanks
...
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 ran into a problem as I tried to create two TIMESTAMP columns in my database. One called created and one called updated. I figured it would be easy to set the default value of both to CURRENT_TIMESTAMP and then ON UPDATE CURRENT_TIMESTAMP for the updated column. But for some reason MySQL means that's a bad idea... so I have been lookin...
I'm running a php/mysql-driven website with a lot of visits and I'm considering the possibility of caching result-sets in shared memory in order to reduce database load.
However, right now MySQL's query cache is enabled and it seems to be doing a pretty good job since if I disable query caching, the use of CPU jumps to 100% immediately.
...
I had a website made for me a long time ago, and the programmer did it in CakePHP. I'm now editing his scripts.
I added a couple columns to a table, and found that doing saveField() on the new column does not do anything. How do I make CakePHP recognize the new columns?
I'd appreciate your help. I'm not too familiar with CakePHP, so pl...
Hi there.
I have a project, where I have posts for example.
The task is next: I must show to user his last posts visit.
This is my solution: every time user visits new (for him) topic, I create a new record in table visits.
Table visits has next structure: id, user_id, post_id, last_visit.
Now my tables visits has ~14,000,000 records and...
I have downloaded MySQL JDBC driver from http://www.mysql.com/downloads/connector/j/. How do I configure it?
...
Hi,
I have created a php script to import rss feed into the database. The feed which is huge (from year 2004 to 2010, approx 2 million records) has to be inserted into the database. I have been running the script in browser but the pace it is inserting (approx. 1 per second) i doubt it takes another 20-25 days to input this data even if...
Table1 has u_name, Table2 has u_name, u_type and u_admin
Table1.u_name is unique. But neither of the 3 fields in Table2 is unique.
For any value of Table1.u_name, there are 0 to many entries in Table2 that Table2.u_name equals to that value.
For any value of Table1.u_name, there are 0 to 1 entries in Table2 that Table2.u_name equals to...
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
...
Having problem with binding parameters to PDO statement. "orderBy" seems not to be passed to query and results are not ordered as suppose to. When I use "price" in query itself all is good but cannot bind paremeter via bindParam. The code is:
class Products
{
const ORDER_BY_NAME="name";
const ORDER_BY_PRICE_PER_UNIT="price_per_unit";
...