Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

Scheduled Pinned Locked Moved Database
helpdatabase
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Naunt
    wrote on last edited by
    #1

    Dear all, Pls help me solve this.

    select distinct voyage_no,vessel_code from D4A_RAW_BLP where vessel_code in (select distinct vessel_code,vessel_desc from D4A_RAW_BLP where vessel_code<>'') order by vessel_code

    when i execute this query error occour as below Only one expression can be specified in the select list when the subquery is not introduced with EXISTS. Thanks and best regards

    T M G 3 Replies Last reply
    0
    • N Naunt

      Dear all, Pls help me solve this.

      select distinct voyage_no,vessel_code from D4A_RAW_BLP where vessel_code in (select distinct vessel_code,vessel_desc from D4A_RAW_BLP where vessel_code<>'') order by vessel_code

      when i execute this query error occour as below Only one expression can be specified in the select list when the subquery is not introduced with EXISTS. Thanks and best regards

      T Offline
      T Offline
      thatraja
      wrote on last edited by
      #2

      The sub query returns 2 columns but in where clause only one column. The query should be like

      select distinct voyage_no,vessel_code from D4A_RAW_BLP where vessel_code in (select distinct vessel_code from D4A_RAW_BLP where vessel_code<>'') order by vessel_code

      thatraja


      Tips/Tricks|Brainbench certifications|Facebook|Twitter

      1 Reply Last reply
      0
      • N Naunt

        Dear all, Pls help me solve this.

        select distinct voyage_no,vessel_code from D4A_RAW_BLP where vessel_code in (select distinct vessel_code,vessel_desc from D4A_RAW_BLP where vessel_code<>'') order by vessel_code

        when i execute this query error occour as below Only one expression can be specified in the select list when the subquery is not introduced with EXISTS. Thanks and best regards

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        I had to read that twice before it sank in what you are doing. Besides trying to compare 1 field to 2 fields in the subselect (which is only allowed to return 1 field) have you looked at the where clause.

        select distinct voyage_no,vessel_code from D4A_RAW_BLP where vessel_code <> ''

        This should achieve the same thing without the sub select.

        Never underestimate the power of human stupidity RAH

        1 Reply Last reply
        0
        • N Naunt

          Dear all, Pls help me solve this.

          select distinct voyage_no,vessel_code from D4A_RAW_BLP where vessel_code in (select distinct vessel_code,vessel_desc from D4A_RAW_BLP where vessel_code<>'') order by vessel_code

          when i execute this query error occour as below Only one expression can be specified in the select list when the subquery is not introduced with EXISTS. Thanks and best regards

          G Offline
          G Offline
          Ganu Sharma
          wrote on last edited by
          #4

          try this query.......... select distinct voyage_no,vessel_code from D4A_RAW_BLP where vessel_code in (select distinct vessel_code from D4A_RAW_BLP where vessel_code is not null) order by vessel_code

          Regards: Ganu Sharma ;)

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups