Scan 4 selects and display message

Asked

Viewed 32 times

-1

Speak up, people, blz?

I would like to know how to make the following logic in SQL:

if( 1 = select * from tblA or  
    1 = select * from tblB or  
    1 = select * from tblC or  
    1 = select * from tblD or )
    Print 'ABC'
  • 1

    Your question is not clear. You did not inform the SGBD using neither what would be the Print. Do you want to show on the console? Why not use a query for that reason?

  • So I just want a way to do this, I don’t know mt of SQL, if you have another (more efficient) foma you can send, you are welcome :D

  • The print doesn’t matter is just some message I’m going to choose, I believe to resolve this, this is irrelevant

1 answer

2


SELECT 'ABC'
 WHERE EXISTS(SELECT 1
                FROM tblA)
    OR EXISTS(SELECT 1
                FROM tblB)
    OR EXISTS(SELECT 1
                FROM tblC)
    OR EXISTS(SELECT 1
                FROM tblD)
  • Yeah, I get it. You seem to have a lot of experience in Development, I wonder if you can help me in a problem I have: I am developing an application(not only developer), but I program reasonably well in c# . Come on: The problem is this I have a table called Scale: http://prntscr.com/mp25qt <-- Design from it

  • I want to create a Trigger that Blocks the Insert or update on it If it has any scale in the same range and is of the same type. Got it right? Can you help me?

  • @Gustavopedro then has some questions about triggers that block here in the OS already, but without knowing which the SGBD I can’t even tell you which ones

  • It is SQL Server 2012

  • 1

    https://pedrogalvaojunior.wordpress.com/2013/05/02/entendendo-o-comportamento-de-trigger-dml-instead-of-no-microsoft-sql-server-2008-r2-e-2012/

  • Yes, I’ll take a look there vlw :D

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.