Results 1 to 4 of 4

Thread: Obtaining the max.length product name from the product table

  1. #1
    Join Date
    Nov 2002
    Posts
    19

    Obtaining the max.length product name from the product table

    Can anyone help me building SQL for my following query:

    To obtain the product_Name from the product table having the maximum length in all the products under Product table.

    Table Structure is as follows:

    Product_code varchar2(5)
    Product_Name varchar2(35)

    Thanx in advance.

  2. #2
    Join Date
    Feb 2003
    Posts
    14
    Hope this query helps you:
    Select PRODUCTNAME from products
    where LEN(PRODUCTNAME) IN (Select max(len(productname)) from products)

  3. #3
    Join Date
    Feb 2003
    Posts
    14
    the above query would run in sql server. for oracle

    Select productname from products
    where length(productname) IN (Select max(length(productname)) from products)

  4. #4
    Join Date
    Nov 2002
    Posts
    19

    Thumbs up

    Thanx ! it worked as I wanted.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •