S
S
Sergey Brovko2018-02-12 18:25:19
MySQL
Sergey Brovko, 2018-02-12 18:25:19

How to compare 2 database rows?

Hello, the question is simple, but something does not work at all.
There is a MySQL database, it contains N lines, in each N fields, the lines can have both the same and different data regarding the lines. Actually I'm trying to compare these lines, namely to find out how many of the fields are the same.
Those. if there are 2 lines
|value1|textfcvfcv|cfvfcvfc|
|value2|textcolorwfcwfnpy|cfwfcwfc|
That I will receive that one column matches.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
L
longclaps, 2018-02-12
@longclaps

The question is simple, but the idea is stupid - you need to write an expression that compares 2 rows of the database, consisting of N field comparison operations, and you have to do this manually. Or write a script that generates such an expression.

G
Gogeo, 2018-02-14
@Gogeo

You can do this, but for each column you will have to have a separate query
Instead of tableName is the name of the table, instead of column_name_1 is the name of the desired column.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question