database – UPDATE between 2 tables in SQL giving an error

I am trying to perform an update and this brings me the following error:
"Message 157, Level 15, State 1, Line 40 – An aggregate may not appear in the UPDATE statement setting list."

Here is the UPDATE code:

    UPDATE Sale_Cartao SET
Sale_Cartao.ID_Caixa = (SELECT separate Caja_ID FROM Caixa_Movimentacao a
where a.Page_ID = 3 and a.Value = convert (decimal (18,2),
convert (decimal (18,2), SUM (vc.Pay.Payment))) and DAY (Data_Movimentacao) =
DAY (vc.Data) and MONTH (Date_Movimentacao) = MONTH (vc.Data) and
YEAR (Date_Movimentacao) = YEAR (vc.Data)) from Venda_Cartao vc
You are there or

SQL Server – What is the standard way to create billing system database tables?

You would usually divide this into two tables. There is one main line per invoice and then a second table containing all child lines.

CREATE TABLE dbo.Invoices
(
InvoiceID int PRIMARY KEY,
CustomerID int, - FOREIGN KEY REFERENCES dbo.Customers ...
Billing date
...
)

CREATE TABLE dbo.InvoiceDetails
(
InvoiceDetailID int PRIMARY KEY,
InvoiceID int NOT NULL EXTERNAL KEY REFERENCES dbo.Invoices (InvoiceID),
ProductID int, - FOREIGN KEY REFERENCES dbo.Products ...
Int quantity,
...
)

MySQL has put GRANT CREATE only as a limit for creating tables and databases

I create a MySQL server and I have created a user and I have given permission to create databases and tables, but this also includes the permission to create a user or to delete it, which does not interest me.

Ubuntu Fatal error: Unable to open and lock privilege tables: mysql.host table & # 39; does not exist

I woke up today on a server that had no problem until recently by generating the following error:

190713 3:40:02 InnoDB: Compressed tables use zlib 1.2.11
190713 3:40:02 InnoDB: Initializing the buffer pool, size = 128.0M
190713 3:40:02 InnoDB: Initialization Complete Buffer Pool
190713 3:40:02 InnoDB: The most supported file format is Barracuda.
190713 3:40:02 InnoDB: Waiting for the start of the background threads
190713 3:40:03 InnoDB: 5.5.62 started; log sequence number 120778290313
190713 3:40:03 [Note] Host name of the server (link address): 0.0.0.0 & nbsp; port: 3306
190713 3:40:03 [Note]   - "0.0.0.0" is resolved to "0.0.0.0";
190713 3:40:03 [Note] Socket server created on IP: "0.0.0.0".
190713 3:40:03 [ERROR] Fatal error: Unable to open and lock privilege tables: mysql.host table & # 39; does not exist

This is on an Ubuntu 16.04 server. In my opinion, an automatic update is triggered.

I already have a handful of databases on the server, so I'm a little
Concerned the only answers I found are to completely uninstall mysql and reinstall it.

Any suggestion would be appreciated.

plugins – Statiscal wordpress site using imported Excel tables

Hello and thank you to all who can share help.

I create a website containing many static table data from a game that I update daily.

I import the data and convert it into Excel tables, then I have to import Excel tables from the wordpress site. And here is my problem.
I want to import about 50,000 tables and once I have finished the html and css updates, just update them by simply importing the new Excel tables. I have reviewed WpDatatables and Tablepress but I am not convinced that they can handle the number of tables.
I've also looked at paid plugins like ipushpull and caspio, which seem a little exaggerated.
I am also open to the ideas that they will excel and directly convert the data.
Any help would be greatly appreciated.

javascript – Loading in two CSV files and storage in two separate tables

As the title indicates, I load (or at least try) two CSV files and store them in two separate tables. What I've worked on so far, but it's not the most elegant or the most effective solution.

The ultimate goal is to read two CSV files and make comparisons between them – that's why it's important to separate them.

Note – I use the Csv-parser library, but I am open to different solutions.

const express = require ("express");
const parse = require ("csv-parser");
const fs = require ("fs");

const app = express ();

constant port = 3000;

var CSVOne = [];
var CSVTwo = [];

fs.createReadStream ("public / activity.csv")
.pipe (parse ())
.on ("data", data => CSVOne.push (data))
.on ("end", () => {
sender = CSVOne.map (d => {
return {
email: d.Sender
};
});
fs.createReadStream ("public / groups.csv")
.pipe (parse ())
.on ("data", dataTwo => CSVTwo.push (dataTwo))
.on ("end", () => {
a = CSVTwo.map (d => {
return {
clinic: d.one
};
});
console.log (sender);
console.log (one);
});
});

app.listen (port, function () {
console.log ("The server has started");
});

mysql – Strategies for redesigning the database schema on non-standard command pool tables in the inventory system

As my first database-based program using SQL, I created this program more or less on the fly, learning as I went … trying to be cautious – but more or less created in order to simply work … a little foresight in longevity, stability, reliability, organization, everything else.

The case in point is an ecommerce store. Many sales channels, in some cases many accounts on said channels.

The result was a table for each channel and, if the channel had multiple accounts, one table for each account.

Current configuration of the table for orders

╔══════════════╦═════════════════════╦════════════ ═════════╦═════════════════════╗
AmazonOrders ║ eBayOrders_account1 ║ eBayOrders_account2 ║ eBayOrders_account3 ║
╚══════════════╩═════════════════════╩════════════ ═════════╩═════════════════════╝

And up to 5 different tables for eBayOrders from different accounts.

Do not stop there.

Have tables in my database for ..

╔═══════════════╦══════════════╦═══════════════╦══ ═════════════════╗
BonanzaOrders ║ NewEggOrders ║ ShopifyOrders ║ WooCommerceOrders
╚═══════════════╩══════════════╩═══════════════╩══ ═════════════════╝

And that's not all to be honest, but it should give you an idea of ​​how things are going.

To deepen, each table has roughly the same data or columns, or at least there is a "base" for the data I was looking to acquire and insert into the database.

Example:

CREATE TABLE `WooCommerceOrders` (
`id` int (11) NOT NULL,
`OrderID` int (11) DEFAULT NULL,
`OrderLineItemID` varchar (255) COLLATE utf8_unicode_ci DEFAULT NULL,
`BuyerEmail` varchar (255) COLLATE utf8_unicode_ci DEFAULT NULL,
`Title` varchar (255) COLLATE utf8_unicode_ci DEFAULT NULL,
`SKU` varchar (80) COLLATE utf8_unicode_ci DEFAULT NULL,
`Quantity` int (11) NOT NULL,
`TransactionPrice` decimal (6,2) DEFAULT NULL,
`transformed 'tinyint (1) NOT NULL DEFAULT' 0 '
`` createdtime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci;

A good contrast would be an eBay store table, at the request of which I added a few extra columns to store data such as fees associated with eBay, etc.

CREATE TABLE `eBayOrders_account1` (
`id` int (11) NOT NULL,
`OrderLineItemID` varchar (255) COLLATE utf8_unicode_ci DEFAULT NULL,
`SalesRecordNumber` int (11) DEFAULT NULL,
`BuyerUserID` varchar (255) COLLATE utf8_unicode_ci DEFAULT NULL,
`BuyerEmail` varchar (255) COLLATE utf8_unicode_ci DEFAULT NULL,
`Title` varchar (255) COLLATE utf8_unicode_ci DEFAULT NULL,
`SKU` varchar (80) COLLATE utf8_unicode_ci DEFAULT NULL,
`Quantity` int (11) NOT NULL,
`TransactionPrice` decimal (6,2) DEFAULT NULL,
`FinalValueFee` decimal (6,2) DEFAULT NULL,
`PayPalFee` decimal (6,2) DEFAULT NULL,
`transformed 'tinyint (1) NOT NULL DEFAULT' 0 '
`createdtime` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE = InnoDB DEFAULT CHARSET = utf8 COLLATE = utf8_unicode_ci;

Fast ventilation .. d & # 39; habit Two command lines were needed to set up a unique key constraint in the table to avoid duplicates. Reason behind Order number and OrderLineItemID which is a kind of suborder of the original Order number that WooCommerce calls.

eBay has a OrderLineItemID and SalesRecordNumber the terminology they use to assign orders, hence this.

The only exception is my ShopifyOrders table, which has three order identifiers in the table. Order number OrderLineID and Order number.

Now, I'm not trying to make it a novel, but I'm really looking for advice on the best way to do this redesign of the database.

I am decently familiar with relational tables, normalization, foreign key relationships, and so on. now, less general concepts and some practices.

My question is: what would be an acceptable scheme for such a database of commands and sources?

I should not consolidate ALL my command tables into one, right?
With a foreign key table of all channels, linking them together.
I think it might be ok if the number of columns was the same in all tables, but like Shopify with three order identifiers, I think if I consolidated the tables, I probably should do it by Channel?

This means grouping my eBay orders into one and assigning another table to give it a unique key to link because all my eBay tables and columns are the same.

Second thought, I should probably try to make the tables as uniform as possible. This seems rather obvious now. Having a table indicates a Price column like different terminologies such as TransactionPrice, Item price, etc., seems to serve only to complicate matters.

Fees like FinalValueFee, PayPalFee, for eBay orders – seem better served in a relational chart and not the table itself.

Any other tips or strategies? I always learn as and when, and hope it is my last reform to reduce it.

How can I group / consolidate tables? My experience with previous standardization techniques would imply that I want to put all the controls of all the channels into one table, but (and I could be wrong), I do not think it would be better served here, for reasons of simplicity. organization and data-column inconsistency reasons. Should we even group the eBay order tables? Or am I missing something simple and should break it down in another way?

Before diving and trying to clean some of my previous problems, how could this schema be designed to better serve system data?

A huge thank you, it's a huge achievement for me to try to get an opinion or sound advice – I would appreciate it.

mysql – SQL Join 3 tables with null values

I have a query that returns the members, their last visit and their last payment. My problem is that it does not return members without a visit and / or payment.

Previously, I did not include the last visits and then I had a query with LEFT and RIGHT JOINs instead of INNER but when I added the table of visits, I would not have the same. got help from Som, but we did not notice that we were missing members with null values. visiting or paying.

I tried to apply the LEFT and RIGHT JOINTS without any luck.
I've also tried adding, for example. "OR (pt.member_id IS NULL)" also unsuccessfully.

TO SELECT
m.m.member_id,
mr.nom,
mr.tag,
pt.semester,
pt.date,
vt.date,
OF
mr members
INTERNAL JOINT
payment pt
SURE
pt.member_id = mr.member_id
INTERNAL JOINT
(SELECT
Member IDs,
MAX (payment_id) max_value
OF
Payment
BY GROUP
member_id) pt2
SURE
pt.member_id = pt2.member_id
AND
pt.payment_id = pt2.max_value
INTERNAL JOINT
visit vt
SURE
vt.member_id = mr.member_id
INTERNAL JOINT
(SELECT
Member IDs,
MAX (date) max_visit_value
OF
visit
BY GROUP
member_id) vt2
SURE
vt.member_id = vt2.member_id
AND
vt.date = vt2.max_visit_value

I want to get a result where visit and / or payment can be zero.

I hope I make sense and that someone can help me 🙂

information design – What are the best practices considered when designing data tables?

Battery Exchange Network

The Stack Exchange network includes 176 question and answer communities, including Stack Overflow, the largest and most reliable online community on which developers can learn, share knowledge and build their careers.

Visit Stack Exchange

States and behavior of progress bars in tables

Nowadays, it is not uncommon for data tables to contain more complex user interface elements (not just data), with items such as pills (or tags), call-to-call buttons action, icons and even graphics to be integrated.

However, I have not yet seen the specific behavior of these embedded UI elements specified in the context of a child element in a table cell.

So the question is what happens to a progress bar (and other elements of the UI) when the row of the table passes from different states (hover, active, selected, etc.) and how the Does style and behavior change compared to outside a table?

A specific example is to consider what happens in a table cell containing a progress bar (which is actually not unusual to see) if it is selected. Should it be:

  1. Unchanged (even though there may be contrast problems with the selected state of the table cell).
  2. Changed by changing the color or style
  3. A custom rule to the behavior of the table to support the interaction

If you can include screenshots of real-world application examples (rather than CodePen or design concepts), this would be very useful to illustrate the answer.