sql server - Correcting a "Subquery returned more than 1 value error" when -


i have idea what's wrong query, seems sql has disassociated converted date (i have 3 fields needed combined make date) product table. question how fix it? can't check if current date > greater 3 separate columns, needed combine them single date.

select productid ctbo.dbo.product (getdate() > (select   convert(date,cast([expyear] varchar(10))+'-'+                     cast([expmonth] varchar(10))+'-'+                     cast([expday] varchar(10)))                     product expyear not '0' , expday not '0' , expmonth not '0') ) 

since subquery returns multiple values need use either any keyword (to make condition applied of subquery result) or all (to applicable results) e.g.:

select productid ctbo.dbo.product (getdate() > any(select   convert(date,cast([expyear] varchar(10))+'-'+                     cast([expmonth] varchar(10))+'-'+                     cast([expday] varchar(10)))                     product expyear not '0' , expday not '0' , expmonth not '0') )  

Comments

Popular posts from this blog

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -

java - JavaFX 2 slider labelFormatter not being used -