Goran Bibic

Goran Bibic

  • 455
  • 2.9k
  • 198k

conect two different query in one table

Jul 14 2023 8:00 AM

I need to conect two different query in one table

 

Basically treating each query as an individual column.

Error is

Msg 512, Level 16, State 1, Line 1
Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

 SELECT 
  (select sifra as cdr1  
   from popis_repromaterijal_roba as c with (nolock) 
  ) AS Column1, 
  (select naziv as cdr2  
   from popis_repromaterijal_roba as c with (nolock) 
  ) AS Column2,
  (select sum(kolicina) as cdr3  
   from popis_repromaterijal_roba as c with (nolock) 
  ) AS Column3,
  (select sifra as success1  
   from mp_racun_roba as d with (nolock) 
  ) AS Column4, 
  (select roba as success2  
   from mp_racun_roba as d with (nolock) 
  ) AS Column5,
  (select sum(kolicina) as success3  
   from mp_racun_roba as d with (nolock) 
  ) AS Column6
  

 


Answers (2)