sql server 2008 - SQL select subquery no result -


ID likes to use a subquery in my selection statement. Select something like:

  Select (COUNT (*) from table2, in which one = '1') countsubquery, fielda, fieldb testtable where a = 'b'  < As / pre>> 

But when the subquery is removed from the empty Tea full line result. So when subquery = null and fielda n are filled field B, this line is removed from the result because countsubquery = null.

What is the result:

  countsubquery = null fielda = fill fieldb = full   

should Subquery select statement in my case .

** Edit ** Actual query:

  SELECT (driver. [Initial] + '+ + driver. [Driver's name]) as bedrijdernaam, Driver. [Function] function, leasecardriver. [Driver Code] As personeelsnummer, leasecar [Car brand code] as the automerk, leasecar [Car type code] as autotype, leasecar. [License kenteken as as No_]., (Sum (fuel.Amount) of [EXAMPLEDATA $ fuel table] where fuel [crime Date] & gt as fuel; = '--0l 00:00:00 'And fuel [crime date] & lt; =' -. -29 11:59:00 'and fuel.personnelnumber = leasecardriver. [Driver code]) as verbruik, leasecardriver. [Driver code] of change in personeelsnummer1 (VARCHAR (19), leasecontract. [Required agreement on ending], 105) from [EXAMPLEDATA $ lease contract] both involved in leasecontract left [EXAMPLEDATA $ Lease car] einddatum leasecontract As on as leasecar. [License no_] = leasecar [License No_] Join the left [EXAMPLEDATA $ lease company] as leasecompany.Code = lease peet at leasecompany. [Lease company code] leasecardriver as leasecardriver as left zone [EXAMPLEDATA $ lease car driver] leasecardriver.license = leasecar. [License No_] Join the left [EXAMPLEDATA $ driver] as the driver on the leasecardriver. [Driver code] = driver. [Driver] where (Leasecontract. [Situation] = '0' or Leasecontract. [Situation] = '1') and ((the driver. [Voronam] + '' + driver. [Driver name]) '%%') or (Lisek. [license plate] like '%%') or (driver [cost location code] like '%%') or (the driver. [Bijneslain (GP)] like '%%') or (the driver. [Salaris Unit (GP)] '%%') or (lessee Kardivr. [license code] as '%%'))   

after the choice is: "Lisek. [License number] AS kenteken, "

If I represent If so, then it must be added as a comment.

If I understand it correctly, then the syntax goes for you, but you are having problems with such records where Sabakuri tap is in the case. In this case, I think it is a value Is:

If the result is null, you can specify an alternate value, so it should also show in your result set.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -