How can I get the records of a field in a table, if I first have to compare two concatenated fields from two different tables?

0

Example of what I want to do but it does not return any value to me:

select select CONCAT('1','-22',valor,'-12')concatenado
from t1,t2 
where concatenado=registro  

Well my database manages two tables, projects and accounts, where projects have the fields of departure, January-December and total, while accounts have the fields account, account_name and debtor. Now what I need is to make a concatenation with other data defined plus the heading of the table projects, which should be similar to the account field of the table accounts and so be able to compare them and if they are equal then you should throw me the debtor field as result of such consultation.

    
asked by Madaley 11.07.2018 в 00:07
source

1 answer

0

you should put more information ... but according to it is understood you can not compare data within a concatenation, its place where you specify them indicually.

select t1.deudor
from t1,t2 
where t1.cuenta= select CONCAT('1','-22',valor,'-12')concatenado

It could be with this, as understood should be so, although I see something not very functional, in case it does not show then be more descriptive and put forums of the tables and the results you expect ...

By: JJ

    
answered by 11.07.2018 в 00:21