Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Operand should contain 1 column(s) 1

Status
Not open for further replies.

monkle

Programmer
Feb 11, 2004
132
US
I have been working on writing a query all morning, and am into the debug phase. When I try to run the query, the sql server returns: "Operand should contain 1 column(s)". I have looked around, trying to find the flaw in the query and also trying to narrow down where the error might be. I haven't found anything yet, which in my experience means that either it's a rare and unusual problem, or it's a problem with a painfully simple and obvious solution.

The query is meant to use join statements to return information from nine tables in a relational database. If you have suggestions for where in the query to look for the problem, it would be appreciated
 
it's your gepflingle column in the verschnuken table

at least, that's what my crystal ball tells me when i look at your query

:)

r937.com | rudy.ca
 
Thank you for such a verbose description of the answer "No, I don't know if this is common".

I know very well that the most common use of the forums involves inspection of raw code rather than abstract conceptualization.

Since a more detailed inspection is desired, I will post the query itself for you to inspect (if you want to) while I go back to query comparisons with existing working models:

Code:
select product_id.product_id, product_id.product_type_cd, product_id.title_id, product_id.upc, product_id.date_added, product_id.date_updated, product_type.desc_product_type, attributes_video.condition, attributes_video.original_language_cd, attributes_video.rating, attributes_video.runtime, attributes_video.subtitled, attributes_video.dubbed, languages.language_desc, product_genre.genre_cd, genre.desc_genre, product_awards.award_id, awards.desc_award 
from product_id 
left join (product_type, attributes_video, product_genre, product_awards) 
on (product_id.product_type_cd=product_type.product_type_cd, product_id.product_id=attributes_video.product_id, product_id.product_id=product_genre.product_id,product_id.product_id=product_awards.product_id) 
left join (languages) 
on (attributes_video.original_language_cd=languages.language_cd) 
left join (genre) 
on (product_genre.genre_cd=genre.genre_cd) 
left join (awards) 
on (product_awards.award_id=awards.award_id)
where product_id.product_id='PID0000003'
 
your problem area is marked in red --
Code:
select product_id.product_id
     , product_id.product_type_cd
     , product_id.title_id
     , product_id.upc
     , product_id.date_added
     , product_id.date_updated
     , product_type.desc_product_type
     , attributes_video.condition
     , attributes_video.original_language_cd
     , attributes_video.rating
     , attributes_video.runtime
     , attributes_video.subtitled
     , attributes_video.dubbed
     , languages.language_desc
     , product_genre.genre_cd
     , genre.desc_genre
     , product_awards.award_id
     , awards.desc_award 
 from product_id 
[COLOR=red]left 
  join (
       product_type
     , attributes_video
     , product_genre
     , product_awards
       ) 
    on (
       product_id.product_type_cd
     = product_type.product_type_cd
     , product_id.product_id
     = attributes_video.product_id
     , product_id.product_id
     = product_genre.product_id
     , product_id.product_id
     = product_awards.product_id
       )[/color] 
left 
  join (languages) 
    on (attributes_video.original_language_cd
     = languages.language_cd) 
left 
  join (genre) 
    on (product_genre.genre_cd
     = genre.genre_cd) 
left 
  join (awards) 
    on (product_awards.award_id
     = awards.award_id)
 where product_id.product_id
     = 'PID0000003'
try this instead --
Code:
select ...
  from product_id 
left 
  join product_type
    on product_id.product_type_cd
     = product_type.product_type_cd
left 
  join attributes_video
    on product_id.product_id
     = attributes_video.product_id
left
  join product_genre
    on product_id.product_id
     = product_genre.product_id
left
  join product_awards
    on product_id.product_id
     = product_awards.product_id       
left 
  join languages
    on attributes_video.original_language_cd
     = languages.language_cd
left 
  join genre 
    on product_genre.genre_cd
     = genre.genre_cd 
left 
  join awards 
    on product_awards.award_id
     = awards.award_id
 where product_id.product_id
     = 'PID0000003'

r937.com | rudy.ca
 
Thank you, that works beautifully.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top