Error Duplicating ASPNET CORE Insertion Information

When I add an employee, I ask for the data of the company, adding the next employee asks me again the data of the company and generates duplicate records. If the two employees are from the same company as it should be my validation so that I do not r

Get the 5 best results by difference between rows

I'm wondering if this is even possible to do purely with MySQL. A top 5 list that is ordered as most improved between 2 different entries of the same data-point. id | year | amount -------+----------+-------- 1 | 2016 | 4000 1 | 2017 | 3000 2 | 2016

Access denied for ODBC user @ localhost

i have installed Mysql on Windows7, i used mysql with mysql command line client & i also use Mysqldump in windows cmd, & it was working without any problem. But today, i tried to export database using mysqldump with this command in cmd mysqldump –

Group with the calendar quarter as a column

I want the sum of one column of my table, but, the result i want is the sum group by 3 by 3 months. To be more specific, and since now, sorry about my english what I has already is the sum of the column I want month by month: select month(emitido_dat

MySQL ranking with GROUP BY and SUM

I have a point table with some columns being: | user_id | points | -------------------- | 1 | 10 | | 5 | 10 | | 5 | 50 | | 3 | 15 | | 3 | 10 | I would like to get the rank for each user with MySQL. I've seen this post MySQL get row position in ORDER

HTML backup with PHP & amp; MySQL

I'm having troubles with saving certain characters to MySql database table from PHP. I have a WYSIWYG editor through which I create page content and save them to a DB. When I have ' ' or apostrophe in my code, the html text doesn't get saved to the D

blob \ text MySQL images return NULL

I post few days ago Pass MySQL medium blob into IOS NSData\UIImage but didn't manage to find a solution yet. my specific problem is that when I retrieve images from database, blob or text, it returns NULL, rows that don't have variables in them just

MySQL view: convert a unix timestamp to a datetime

How do I convert timestamps in a MySQL View? I have a MySQL View for data exchange between 2 different software tools. The original table is a unix timestamp as int(11). The other software expects a DATETIME. I have a VIEW like this: CREATE VIEW `myV

Simple Find and replace the PHP / MySQL script

I've been plugging away at this simple script and think it's time I try and get some help. I am trying to make a PHP script to communicate with my database. I want to be able to write an array with all the words to find and all the words to replace t

How can I include mysql.h and my_global.h in Makefile.am?

I'm trying to create a C program that can communicate with MySQL database via these two header files: mysql.h my_global.h MySQL comes with mysql_config script that you can execute to find out where the include files and library files reside in the sy

Sql Line count for two columns where col1 is identical to col2

i'm breaking my head in combining next two queries in one: SELECT Data1, COUNT(Data1) FROM Table GROUP BY Data1 ORDER BY Data1; SELECT Data2, COUNT(Data2) FROM Table GROUP BY Data2 ORDER BY Data2; so result will look like: data1 count1 data2 count2 A

mysql table structure proposal?

is this table any good for mysql? I wanted to make it flexible in the future for this type of data storage. With this table structure, you can't use a PRIMARY KEY but an index ... Should I change the format of the table to have headers - Primary Key,

View the selected country in a drop-down list using PHP

On my page I have a dropdown menu with a list of countries, this is a page for users to update their address details so I would like to have the "selected" value when they visit the page set to what the entered upon signup. I have <option val

How to recover data from two linked tables filter by a table?

I need to fetch data from two tables For example: I have tables test1, test2. Test1 is the parent table. I need to fetch data is that present in test1 but not in test2. How can I write a query for that? select id from test1, test2 where test1.id not

Need to extend my query

First, I have this query: SELECT `a`.`title`, `a`.`askprice`, `a`.`picture`, `a`.`description`, `a`.`userid`, `a`.`id` FROM (`mm_ads` AS a) LEFT JOIN `mm_ads_fields_values` AS afv ON `a`.`id` = `afv`.`aid` WHERE `a`.`status` = 1 AND `a`.`category` =

format the mysql data in the array

I am pulling data from my database and trying to encode into JSON data using json_encode. But to make it easier to read in my android app. I was hopping to format it differently then I am currently doing. Please see bottom encode string example. Any

Mysql SQLite synchronization databases

Possible Duplicate: how to sync SQLite database on android phone with MySQL database on server? I am wondering what is the best approach to updating a database on an Application. We have a mysql database that handles everything on the main server, bu

Add a column that does not exist in a query

I want to add a column in a query that does not exist in a table and return it as a result. So lets say TABLE_TEST has column A, B and I want to return values for A, B and C. I am trying to do SELECT A, B, C=3 FROM TABLE_TEST or SELECT *, C=3 FROM TA

Part allocation algorithm with PHP

I need help with an algorithm to allocate rooms to people. I need to shuffle through a list of rooms to assign a room to a person and after the fourth person is assigned to the room, it should be out of the list(should be unavailable). I have not had

C ++ program communicating with the MySQL database

Does anyone know of a simple way for a C++ program to communicate directly with a MySQL database? I have looked at MySQL++ and found it to be very confusing. If anyone knows of a very simple way of doing this, please let me know. Thanks P.S. I am dev

Database design: composite key vs primary key of a column

A web application I am working on has encountered an unexpected 'bug' - The database of the app has two tables (among many others) called 'States' and 'Cities'. 'States' table fields: ------------------------------------------- idStates | State | Lat