Jump to content

Juntar Records Num Só


Go to solution Solved by KTachyon,

Recommended Posts

Posted (edited)

Bom dia,

eis o que tenho:

FKTab | FKDC | Combo | SimNA
6203 | 1 | FE | N/A
6203 | 1 | DD | N/A
6203 | 1 | O | N/A
6203 | 1 | FS | N/A
6203 | 1 | F | N/A

Eu precisava de algo como

FKTab | FE | Resposta | DD | Resposta | O | Resposta | FS | Resposta | F | Resposta
6203 | N/A| 1 | N/A | 1 | N/A | 1 | N/A | 1 | N/A | 1

É possivel fazer isto? E como é que consigo?

Cumprimentos,

TS91

Edited by TS91
  • Solution
Posted

Alguma razão para quereres fazer isto apenas com SQL?

SELECT t1.FKTab, t1.SimNA, t1.FKDC, t2.SimNA, t2.FKDC, t3.SimNA, t3.FKDC, t4.SimNA, t4.FKDC, t5.SimNA, t5.FKDC FROM tabela t1
INNER JOIN tabela t2 on t1.FKTab = t2.FKTab
INNER JOIN tabela t3 on t1.FKTab = t3.FKTab
INNER JOIN tabela t4 on t1.FKTab = t4.FKTab
INNER JOIN tabela t5 on t1.FKTab = t5.FKTab
WHERE t1.Combo = "FE" AND t2.Combo = "DD" AND t3.Combo = "O" AND t4.Combo = "FS" AND t5.Combo = "F";

“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”

-- Tony Hoare

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.