3

It's hard to compose a topic name for me. But I can show an example :

WHERE   (SELECT [ID_Line] FROM [Event] WHERE [Event].[Name]  = [A].[Col]) = 2
AND     (SELECT [DataType] FROM [Event] WHERE [Event].[Name]  = [A].[Col]) = 2

Here I'm processing 2 queries when I really need something like that :

WHERE   (SELECT [ID_Line],[DataType] FROM [Event] WHERE [Event].[Name]  = [A].[Col]) = 2,2

but SQL doesn't work with tuples, so must I make Inner Join here ?

cnd
  • 32,616
  • 62
  • 183
  • 313

2 Answers2

7

you can try something like this :

WHERE EXISTS (
    SELECT [ID_Line] FROM [Event] WHERE
        [Event].[Name]  = [A].[Col] AND
        [Event].[ID_Line] = 2 AND
        [Event].[DataType] = 2
)

If you provide more information about the complete query and your database structure, a more precise answer could be given. It is possible that this isn't the best solution.

krtek
  • 26,334
  • 5
  • 56
  • 84
0

You can try to melt the fields using a melting operator. In ORACLE PL/SQL you use || (double pipe), for example.

UltraCommit
  • 2,236
  • 7
  • 43
  • 61