Employee Query question

Suppose im having employee table with fields, eno, ename, dept, address1, address2, address3. In address field employee can fill only address1 or address2 or address3... at a time he can fill three address fields. now i want all employee names who filled only one address field..

Questions by Shashipal Reddy

Showing Answers 1 - 7 of 7 Answers

Code
  1.  

  2. SELECT * FROM employee WHERE

  3. (address1 LIKE '%' AND address2 LIKE ' '

  4.  AND address3 LIKE ' ')

  5. OR (address1 LIKE ' '

  6. AND address2 LIKE '%'

  7. AND address3 LIKE ' ')

  8. OR (address1 LIKE ' '

  9. AND address2 LIKE ' ' AND address3 LIKE '%')

  10.  

  Was this answer useful?  Yes

ashok2909

  • Aug 1st, 2011
 

As far as i know use concatenation operator...

Code
  1. SELECT ename AS name,address1 || ',' ||address2||','||address3 AS address FROM employee

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions