I am left joining 4 tables to get SUM of the amount that is present in first table. So far, I've tried many alternatives to get the sum straight, but either it becomes 0 (if I group_by), or duplicates, if I don't use group_by. here is my code: $this-
I have the following mysql table: Here in this table there could be houndred of thousands of rows, in which some may be with the same fir_sno [column No. 2]. My problem is that to select only the distinct rows from this table order by sno desc order.
I am having a problem when searching the database for utf8 enocded strings in MySQL. I have a kind of a social website with users and they are allowed to add descriptions for their profile and because in my country we use cyrillic alphabet the obviou
Got stuck on this one, know it should be simple. But I have a list of unique IDs that looks like AB123456, XY584234, CDE987654. The last six characters mean something, so I need to find all rows that have the same last six characters as another (subs
I'm trying to write a single page ansible script for mysql installation and setup a new user and create a empty DB. what I've tried so far - hosts file [mysql] webapp ansible_ssh_host=xxx.xxx.xxx.xxx mysql.yml (The single file for all tasks/vars/hand
I have created a webcrawler in python 2.7 and i am using mysqldb to insert data into database. I have executed each function as a different script for different webpages, but after i put them into a single file as functions, the program shows error;
I have a php function that has an array of all of these interest selections for users to choose from. I populate that data like so in a table: foreach($interests as $key=>$value){ ?> <input type="checkbox" name="targetInterests&quo
I have a sales_cat table, and a user_cat table. sales_cat id_cat name user_cat id id_user id_cat I need to get all the sales_cat rows, joined with the user_cat table for a specific user, indicating if that user has or not the category. Example, for i
I'm having a bit of a problem with a MySQL query in my PHP. I'm assuming it's down to a simple syntax issue and am hoping somebody here can help me out. The query is: SELECT * FROM `Threads` INNER JOIN `Categories` WHERE `Threads`.`Category_ID` = `Ca
I read a lot of similar topics, but i can't understand my mistake. Problem: Uncaught exception 'PDOException' with message 'SQLSTATE[HY093]: Invalid parameter number: parameter was not defined' in I:\home\lm.ru\www\classes\db.class.php:39 Stack trace
When creating a table we normally make id field of integer type. But if I don't specify any value in length field how much length data will it store?I found an explanation elsewhere that says the value/length you specify when creating a numeric colum
I have a database of schools, I would like to make it so that when you search the database for existing data, it outputs right next the the input box. So without going to a new page. Here's what a have: <form action=" " method="post"
I have two tables empmaster and allocation. I used union to do sql operation in order to get results from two tables. empmaster has empid and other empdetails. Table allocation contains empid from empmaster as foriegn key another field called per_all
I'm new in web programming and I really need your help. I have a form with several radio buttons and I want to insert them into mysql through an ajax post. I can do it for a single button but for more than one I don't have idea how to do it. This is
I am doing a form that displays the questions and answers in a database and now I need to save the answers marked by the user. I need a name for each RadioButton or select dropdown. PROBLEM: I combine php and html and i don't know how to pass the rad
This is the code for the form: <div id="regform"> <div id="regform-top"> <h2>User Registration</h2> <p>Please complete this form</p> </div> <form id="register-form" name="regi
I hope someone could give me a general direction on this problem: The starting point is an array of ids of db records. array ids = [45,23,14,7]; Those records have some columns, i.e. id,price,rating 7,$5.00,5 14,$2.00,4 23,$5.00,2 45,$5.00,5 What I w
i have a new website (i'm building one right now) and i want to make sure i do it correctly and not redesigning after 1 month. so i have pages like: /candy /candy/chocolate /drink /drink/beer so i look on stackoverflow about how can i do this and i f
I want to set the field coins to 100, in the accounts table for every row that has a unique PASSWORD. Is that possible in MySQL?I think this would work: UPDATE accounts SET coins = 100 WHERE userid IN ( SELECT * FROM ( SELECT userid FROM accounts AS
Im having a problem comparing dates in a database to a week from now using activerecord. I'm trying to return a list of events with their start date less than a week from now. The event_start_date is in the format of 2011-06-30 09:00:00 $this->db->s
I have a sql schema dump from phpmyadmin. I want to create a new database from that schema on a new machine. I have tried this: mysql -uuser -ppwd < schema.sql It says no database is selected. I know that I could CREATE database first then import, bu
Is there any way I can get datetime format like 'YYYY-MM-DD HH:MM:SS' to be stored as datetime format in mysql from android date of format 'MM-DD-YY' and time of format 'HH:MM' Input : android date 'MM-DD-YY' and android time 'HH:MM' Output: mysql da
RESOLVED! THANKS EVERYONE. I need to search for duplicates - table as follows: id, q1, q2, q3, text id is unique and I am only interested in finding duplicates where the field text is the same. Any suggestions as I have no idea where to start! Thanks
I have been using EMS MySQL Manager for a while now, however my system died last week and I have since had to transfer anything I can get my hands on to a new machine. EMS is giving me problems though, I can't for the life of me work out where the us
How to execute Multiplication Operation in a Mysql Query? If my query is like this : "SELECT registration.hosteladmissionno, registration.student_name, registration.semester, student_month.hosteladmissionno, student_month.student_name, student_month.
I have a mysql fields like this: url_id time_spent ------- ---------- 120 14 120 97 120 14 120 97 I want to display only 14 and 97 based on url_id(DISTINCT). select * from table group by url_id,time_spent
First select query Table 1: ID Value 131 ABC 120 DEF Second select query Table 2: ID 120 131 I want to write a single query which will fetch me combining two tables (the required output) ID Value 120 DEF 131 ABC Note: if there is no entry in Table2,
I'm trying to compile a C++ program and one of the classes uses . g++ is not able to find the libraries would be my guess. The command i use to compile is - g++ c1.cpp c2.cpp c3.cpp c4.cpp -o c4 -lm -lmysqlclient c3.cpp is the file that needs mysql.h
This is based on my previous question. I have the following table Table1 JobPositionId | JobPositionName 1 | Sound 2 | Lights 3 | Sound 4 | Ground How can I delete row three (Name = sound, and max position)Use: DELETE FROM TABLE t1 JOIN (SELECT x.job
Almost all of free web hosting server, you can not use PDO + MySQL. They lack PDO drivers. So I am considering to select pear MDB2, or DB_DataObject. Which do you reccomend to me? Give me your opinions!I would actually recommend using the Mysqli func