Skip to content
Advertisement

Fetch data from one table and compare with another one basic on contain values

I got 2 different databases and 2 tables

Here’s Table.1:

JavaScript

and there’s Table.2

JavaScript

but the users ask for all items separately according

searching the ranking.values using Table.2 and compare with Table.1

How can I use Sql command having the result when something like :

login as user2 so I would get

JavaScript

but if when the user login as user4 than I would get

JavaScript

I try to figure out the SQL parts and the following works has been tested; but no luck:

JavaScript

but so far some of them come out either empty, of just output single result as:

JavaScript

or

JavaScript

I don’t understand where should I change the detail and honestly this is very new problem to me

currently using MySQl 7.4, by PhpMyAdmin also PHP 7.4

There could be a lot informal statement come out of PhpMyAdmin; still trying to make everything work; any help would be appreciate!


Below are the questions I have tried:

sql-query-multiple-records-against-one-column-value-need-to-compare-another

mysql-check-if-a-column-has-values-based-on-another-column

mysql-how-to-check-for-a-value-in-all-columns

Advertisement

Answer

I think this just works fine, according of the WHERE … IN ();

also the results of rank comes from another application, honestly I haven’t had the clue to ask for it with another team

signal as Table.2 I used same method as MySQL query finding values in a comma separated string

JavaScript

but I work it in the PHP file, so that’s why it may look won’t work as expect

JavaScript

or

JavaScript
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement