sql - SELECT count(*) then output empty or not empty with yes or no -


Find out if the location of the sales department is in cities similar to that of the TRANSPORT department "(assuming the empty result means yes and No non-fair result is the meaning)

This table was found in my database.

  // DEPTLOC DAME CITY ---------- ------ Sales London Transport London Transport Boston Science Boston   

Definitely how to write queries but at least I try

  SELECT COUNT (*) DEPTLO How to write after AND operator in SKL in order to get something out of the output (DNAME = 'SALES' and DNAME = 'TRANSPORT') and   

C WHERE

  // Display Yes. (& Lt; --- London, sales and transport in the same city)    

You can use SELECT Decode (Count (*), 0, 'No', 'Yes') from your remaining question}

DECODE compares each search value with one. If the expr is equal to one search, then the Oracle database gives the same result. If no mail is found, then Oracle default comes back. If the default is omitted, then the oracle is empty.

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -