I’d like to make an (MS)SQL query that returns something like this:
Col1 Col2 Col3 ---- --------------------- ------ AAA 18.92 18.92 BBB 20.00 40.00 AAA 30.84 30.84 BBB 06.00 12.00 AAA 30.84 30.84 AAA 46.79 46.79 AAA 86.40 86.40
where Col3 is equal to Col2 when Col1 = AAA and Col3 is twice Col2 when Col1 = BBB. Can someone point me in the rigth direction please?
You didn’t mention what kind of database you’re using. Here’s something that will work in SQL Server: