Questions tagged [mysql++]

174936 questions
1

votes
0

answer
156

Views

multiple query vs batch performance with Mybatis in Spring

I have one question. multiple query vs batch with mybatis in Spring example) case 1. allowmutiquery=true and one call call 'mutiquery' ; update ... set .... case 2. loop multiple call and batch execute for( ; ; ){ call 'batch' ; } update ... set .... what is the way better?
J.K.R
1

votes
1

answer
373

Views

Android sending Lat Long to php and storing in mysql

So I am using Android points = new ArrayList(); to track a users GPS location every 3 seconds, which sometimes can be up to 1,000's or more points if they are on a route long enough. What is the best method for sending this route after they finish to my php and storing it into mysql? I am currently...
user2101081
1

votes
0

answer
102

Views

MySQL: Distance Between Two Points (using MBRContains)

In the post Fastest Way to Find Distance Between Two Lat/Long Points, user Quassnoi provides the following code for calculating the distance between two locations: SELECT * FROM table WHERE MBRContains ( LineString ( Point ( @lon + 10 / ( 111.1 / COS(RADIANS(@lat))), @lat + 10 / 111.1 ), Point...
Greeen
1

votes
1

answer
23

Views

Print last month name in MySQL

Can anyone please help me in getting last month name in MySQL. I am getting the current month name using the query date_format(now(),'%M'), But I am not able to print the last month name by altering this statement.
1

votes
1

answer
36

Views

SQL: Total entries in past 7 days, group by day, if no entries for that day set it as 0

I have a table with following columns: id | time (SQL datetime) | url I need to get totals for last 7 days from today. If totals for that day are 0 - return it as 0 instead of not returning at all. I've tried this: SELECT time, COUNT(*) AS `num` FROM entries WHERE time > DATE_SUB(CURDATE(), INT...
nonToxicGuy22
1

votes
0

answer
34

Views

add multiple same primary key in one row

i have created PromoCode table as follow: PromoCode table: @Entity @Table(name = 'PromoCode', uniqueConstraints = { @UniqueConstraint(columnNames = 'promocode_name', name = 'UK_PromoCode_PromocodeName') }) public class PromoCode { @Id @GeneratedValue(strategy = GenerationType.AUTO) private long id;...
Rahul Chavan
1

votes
2

answer
149

Views

laravel - How to get data by pivot table

I have a problem with laravel. I have created relationships between tables and relationships at the model level in laravel but if I want to display data to the view, I get an error: Property [category] does not exist on this collection instance. the table with the films is called: videos the table w...
White Cat
1

votes
2

answer
545

Views

MySQLdb doesn't work with utf8mb4

The commands Import MySQLdb MySQLdb.connect(user='root', passwd='1234', charset='utf8mb4') Work on Linux. But on Windows it throws the following exception: Operational Error (2019, can't initialize character set utf8mb4 (path: c:\\mysql\\\\share\\charsets\\) ') That path doesn't even exist on my com...
jackLantern
1

votes
0

answer
606

Views

kevent() reported about an closed connection error

we are using FreeBSD, nginx, php-fpm in our server for php (yii) application. Sometimes kevent() reported about an closed connection (54: Connection reset by peer) while reading response header from upstream... occured in server log file and website response reach time out. Service php-fpm restart...
jamilaghasiyev
1

votes
0

answer
209

Views

Mysql cascade delete with set null doesn't work

I have table reviews, having foreign keys to other tables with some relation actions (on delete cascade for user_id, on delete set null for mark_id and comment_id). When comment or mark is deleted corresponding fk in reviews table are set to null, but when user for that row is deleted only mark_id a...
Cyborg
1

votes
2

answer
73

Views

Google chart not draw

I have a one question. google chart not draw. Here is my code google.load('visualization', '1', {packages:['corechart']}); google.setOnLoadCallback(drawChart); function drawChart() { var jsonData = $.ajax({ url: '/temhum', dataType:'json', }).done(function (jsonData) { var data = new google.visuali...
전준휘
1

votes
0

answer
909

Views

How to start mysql and set up the mysql root password for a docker container?

I am trying to host a web server via docker.The web server needs mysql database.But I am failing to change the root password of mysql and also start the mysql and apache2 service. So can someone help me to set the root password and start start the services. Here is my try to setup the docker contai...
Arijit Panda
1

votes
2

answer
24

Views

Join on tables that have multiple records against same id

I have two tables: applicant_personal_info looks like this: A_id FirstName LastName 1 Fahad Subzwari applicant_professional_info table looks like this: A_id JobOrganization JobDuration TotalExperience 1 10Pearls 12 Months...
Fahad_SUbzwari
1

votes
0

answer
30

Views

Group by SQL (or if value is on another table)

I have a table of tournament results with points earned. I want to publish SUM of points for each player and ORDER BY SUM of points DESC. To do this I need to get all results and then group by LVID. The problem is that players LVID is on table A or table B. This is how my code looks right now: SELEC...
Nick
1

votes
0

answer
253

Views

MySQL connection issue in gcloud

I have deployed codeigniter project in google cloud app engine . I am getting database connection problem. Database connection is below - $db['default'] = array( 'dsn' => 'mysql:unix_socket=/cloudsql/tastyeater-190406:us-central1:tastyeater;dbname= databasename', 'hostname' => 'localhost', 'username...
Farman Ali Khan
1

votes
0

answer
180

Views

Xampp Database Replication Setup Error

Scenario I've been trying to set up mysql database replication on my xampp server but its not been working. I get the following error and the error logs display the following message. 2017-12-28 10:14:37 10384 [ERROR] Slave I/O: Fatal error: The slave I/O thread stops because master and slave have e...
Kenziiee Flavius
1

votes
1

answer
106

Views

My-sql one to many relation join get sum of left table column [duplicate]

This question already has an answer here: Where clause for only one table in a left join 4 answers Get all results from first table in a MySQL join 2 answers Return default result for IN value regardless 2 answers When we have two tables with one to many relation how we can get the sum of left ta...
Chythi
1

votes
3

answer
549

Views

inserting multiple records in one row using single checkbox with php mysql

I have confusion in inserting multiple records in one row using single checkbox with php mysql This is my form table cek Kode Mata Kuliah W/P SKS Kelas Tambah This is my form action
Sinta Anjelina
1

votes
2

answer
106

Views

Insert into second column after specific id into csv

I have a table named A with 1000 rows Like: id | name ----+------ 1 | a 2 | b 3 | c 4 | d and so on until id=1000 Now I want to export this table A as CSV which i am able to do. But I want data in 2 columns like data till id=499 should print in 1st column and remaining data should prin...
Rids
1

votes
1

answer
58

Views

Save data into MySQL DB using Hibernate @ManyToOne relationship [duplicate]

This question already has an answer here: How to use @Id with String Type in JPA / Hibernate? 3 answers Edited (not exact duplicate of How to use @Id with String Type in JPA / Hibernate?) Reasons: At the time, the error I was getting was this: org.hibernate.id.IdentifierGenerationException: Unknown...
Adrian Flores
1

votes
1

answer
28

Views

Get results and use them to another query mysql php

How can I use the fetched result to use the values to make another query? I tried to find info on php.net, but can`t figure out. $sql = 'SELECT id FROM orders WHERE customer_id=$customer_id'; $query = mysqli_query($conn, $sql); while($row= mysqli_fetch_array($query)) { $ordersid=$row['id']; } $orde...
Vesselin Cohen
1

votes
1

answer
40

Views

creating a trigger in php-my-admin

i would like to create a trigger using the phpmyadmin 'add trigger' option. The Trigger should run AFTER every INSERT in table comments that takes the highest 'number of comments' (nc in DB) from the table 'POST' and takes the 'ID' and the 'question' of that row and puts it in the 'top_questions' t...
Zyzzx
1

votes
0

answer
19

Views

flask mysqldb call a related table

Flask-mysqldb Is there a way to call the related table without making a new query? if it's stored within the teacher object or something. So I have the id under 'teacher' and they have a relation in MySQL. {% for class1 in classes %} {{class1.name}} {{class1.code}} {{class1.teacher}} Outputs: 'Class...
Jordy
1

votes
0

answer
16

Views

Performance efficient way of searching for combinations of numbers in MySQL table

Let's say we have table of all possible guest placements in hotel room. Here is my table (and the fiddle http://sqlfiddle.com/#!9/d01fa9 ) CREATE TABLE `Placement` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `people` smallint(3) unsigned DEFAULT NULL, `adults` smallint(3) unsigned DEFAULT NULL,...
Terminus
1

votes
0

answer
199

Views

How to skip to next iteration if no results are returned in SELECT statement in Stored Procedure?

I have a case where I SELECT rows from one table and INSERT them to another table. However, I get Error: 1329 SQLSTATE: 02000 if the SELECT statement doesn't return any row. Can I do something like: CREATE PROCEDURE SP() DECLARE CONTINUE HANDLER FOR NOT FOUND; BEGIN ITERATE END BEGIN DECLARE cur1 C...
swdon
1

votes
0

answer
47

Views

Is it proper form to use an image for a button tag within a form tag

as way of background, i have no formal education. i take online courses and am learning this stuff at my own pace with my limited skill set, so i apologize if i'm getting this stuff wrong. project wise, i have a webpage that will have three buttons on it, using images of the affiliations for the...
SoDakSuperman
1

votes
0

answer
74

Views

Tried both ng-repeat and ng-options for select dropdown; query results keep coming back empty

First, let me make a couple of disclaimers: This is my very first time posting a question here. I only do so because I've tried numerous possible solutions to similar questions over the past 24 hours and gotten nowhere. I'm also a complete newbie to AngularJS (using 1.5.6). I'm starting to understan...
Eddie
1

votes
0

answer
76

Views

Which database schema should i use?

I am building a Rest Api using node, MySQL and MongoDB, but i am confused with the database schema to go for as the business case is B2B and for each business(customer) there is like 10 tables for general ledger, products, transactions, clients, sales, purchase and many like these. and for accommoda...
Suraj Malviya
1

votes
0

answer
39

Views

TinyMCE triggers a script that I never included: It's pretty interesting, isn't it?

Ok, beforehand I apologize for my English and theoretical mistakes, but I'm not a native speaker and neither am I a professional. I'm just a student and my level is very basic. The problem I'm dealing with, that I consider crazy, but I can't deny is really interesting is that TinyMCE 4 triggers a sc...
JDoeiseverywhere
1

votes
3

answer
720

Views

How to handle deadlock in Doctrine?

I have a mobile application and server based on Symfony which gives API for the mobile app. I have a situation, where users can like Post. When users like Post I add an entry in ManyToMany table that this particular user liked this particular Post (step 1). Then in Post table I increase likesCounter...
Tom
1

votes
1

answer
85

Views

Insert into datetime field without duplicates in interval sql

i have table with tv shows, in this table there are columns, one for start time and one for finishing time. I need to make that if you want to insert tv show that you cannot put 2 tv shows in same time, like in real television, can you please help me to make this. Thanks. Table tvshows have columns:...
iposave
1

votes
0

answer
39

Views

How to Speed up NOT IN or LEFT JOIN or NOT EXIST in Mysql Query

Hello everyone I am writing this query for Took Not Exist value(For Validation), I have 51000 records in table A, And in table B 36000 records Query With Not Exist SELECT A.D_ID FROM temp_status_entry AS A WHERE A.Created_by ='1' AND NOT EXISTS (SELECT NULL FROM status_entry AS B WHERE B.NoofLines...
Madhan
1

votes
1

answer
46

Views

how to keep the date unchanged when changing other data?

I want to update the status column in my table, but the date column of the message is also updated. How can I only update the status column only without the date field ? Data type: Status => Varchar messgae_date => Timestamp Query : 'UPDATE mytable SET status='1' WHERE status='0'' Thank's before ..
Aditya
1

votes
1

answer
15

Views

How to count how many times a group of words appear in a column, in any orders?

I have a table that has a column showing pairs of students, such as 'Anna-Bob', 'Anna-Charlie', 'Bob-Dan', 'Bob-Anna','Charlie-Anna'... I want to count how many times each of the pairs of students appears in that column, in any order. For example, for pair 'Anna-Bob', I will count those that have ei...
Annie
-1

votes
0

answer
17

Views

How to remove lower condition in mysql

In mysql-slow file i see the query: UPDATE `transaction` AS `transaction` SET `status` = ? , `updatedAt` = ? WHERE `LOWER` ( `transaction` . `referenceTransaction` ) = ? The lower condition is added automatic by sail mysql library. How can i remove that . Thank for your supporting all. Regards, PT...
Kelvin Phan
0

votes
0

answer
15

Views

MySQL Join twice on the same table gives half of the result

I have 2 tables and making join query, thing is that in the main table I have 2 columns with id which needs to be replaced with full names from second table, thats why I am running query over same table twice. Thing is that it hasn't roughly half of the records, if I change position of joins then se...
-1

votes
0

answer
11

Views

How to create login (MySQL) with multiple types of user in Android

I want to create login activity with multiple types of user. This login is connected with MySQL. The multiple choice is 'Reviewer' and 'Non-Reviewer'. Now I use Spinner and the values I call from string.xml. At the table 'user', there are some column such as 'username', 'password', and 'usertype'. E...
Wan Dila
0

votes
2

answer
21

Views

How to load exact number of rows to jTable from MySQL and paginate the remaining?

I am trying to load data from MySQL into my Application, where I have a jTable. I want to load only 100 rows using a query, and I can do that successfully as of now. furthermore, I want to paginate that data, in such a way that if I have the next button, and I click on that, the table should be upda...
Hefaz
1

votes
2

answer
130

Views

Summing numbers from a Python SQLite3 Query

I would like to do some math with numbers I have stored in an SQLite database. My query seems to work. My issue is having python treat the numbers that I have queryed from the database as numbers. The first definition selects a unique row from my database. The second definition cycles thru a number...
Michael Crowne

View additional questions