Results 1 to 4 of 4
  1. #1
    Join Date
    Oct 2003
    Location
    india, delhi
    Posts
    18

    Question Unanswered: Problem in View: urgent

    I'm using ms-sql server.

    I am creating some views from some tables.

    Problem : Whenever select statement selects nothing in a column, I want to add a row to view a row which has entry as 0

    create view VU_D9_4 as(select vu1.bname, count(T.habname)Sch_within_SC from vu_block_vtcode vu1, aisesvif.dbo.vifq3 T where vu1.VTcode = T.VTcode and T.domby = 1 and distu =0 group by vu1.bname)


    The select statement here select nothing.

    please tell me the solution.
    Sudeesh
    www.GaloisTech.com

  2. #2
    Join Date
    Jun 2003
    Location
    cape town, south africa
    Posts
    102
    try using the isnull() function on the column you expect to be null
    des

  3. #3
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    Use if exists to check your results . Look up the syntax in SQL Server Books Online (The Holy Book).
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Code:
    create view VU_D9_4 
    as
    select vu1.bname
         , count(T.habname) Sch_within_SC 
      from vu_block_vtcode vu1
    left outer
      join aisesvif.dbo.vifq3 T 
        on vu1.VTcode = T.VTcode 
       and T.domby = 1 
       and distu =0 
    group 
        by vu1.bname
    may need to move distu=0 from ON to WHERE

    rudy
    http://r937.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •