Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 'view' problem

Author  Topic 

anakando
Starting Member

3 Posts

Posted - 2008-12-01 : 04:05:25
hi..i have 2 tables and i want to create 1 view from these 2 tables. The problem is, nothing is displayed at my view.It supposedly display about 30 data. Is it something todo with permission?here is my syntax

create view mynewView as select a.bl_id,a.cx,a.cy,b.rm_id,b.area from bl a, rm b where a.bl_id = b.bl_id

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-01 : 04:16:43
did you try excuting query first and see if it returns the data?

select a.bl_id,a.cx,a.cy,b.rm_id,b.area from bl a, rm b where a.bl_id = b.bl_id
Go to Top of Page

anakando
Starting Member

3 Posts

Posted - 2008-12-01 : 04:34:59
yes but unfortunately still no luck..do you have any tips on this??
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-01 : 04:36:52
quote:
Originally posted by anakando

yes but unfortunately still no luck..do you have any tips on this??


does it return results? if no, then definitely you dont have matching values existing on both tables. then how will you expect join to bring back records?
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2008-12-01 : 04:44:01
How do you know it should return 30 data?

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

anakando
Starting Member

3 Posts

Posted - 2008-12-01 : 05:01:13
let say may first table name ,tableA contain 40 data that store list of buildings. my second table,tableB contain 120 data that store list of rooms name. I want to create a view that only store a rooms name(tableB) that tiled on the building name(tableA). Of course i know it should return 30 data because i have only 30 rooms name in tableB that tiled with building name(tableA)
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-12-01 : 05:15:59
are you sure you've same bl_ids existing on two tables?
Go to Top of Page
   

- Advertisement -