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
 SQL Server 2000 Forums
 Transact-SQL (2000)
 create view

Author  Topic 

u2p_inst
Yak Posting Veteran

78 Posts

Posted - 2002-10-30 : 02:39:12
dear all,

i want create view from table like this

FLD1 FLD2 FLD3 FLD4 FLD5
---- ---- ---- ---- ----
KG ONBS 23 12 FLD4-FLD3
KG SBI 33 56 FLD4-FLD3
KG ONBS 34 45 FLD4-FLD3
KG CIM 34 45 FLD4-FLD3
KG NTB 65 44 FLD4
KG ONBS 56 65 FLD4-FLD3
KG OFFS 32 3 FLD4
KG OFFS 66 45 FLD4
KG CIM 2 67 FLD4-FLD3
KG NTB 65 56 FLD4
KG NTB 34 87 FLD4
KG OFFS 75 34 FLD4
KG SBI 76 45 FLD4-FLD3
KG SBI 23 76 FLD4-FLD3
KG OFFS 89 78 FLD4

Please help me out...

oh

Crespo

85 Posts

Posted - 2002-10-30 : 03:01:22
OK.. but which columns you want to include in your view though? You mention the the table with 5 columns but do you want to create a view of the whole table? What conditions do you need?

You really have to be more specific in your question I'm afraid otherwise we can't help you much.

Best Regards.

Crespo.
Hewitt Bacon & Woodrow
Epsom
Surrey
United Kingdom
Go to Top of Page

u2p_inst
Yak Posting Veteran

78 Posts

Posted - 2002-10-30 : 03:46:21
FLD1 FLD2 FLD3 FLD4 FLD5
---- ---- ---- ---- ----
KG ONBS 23 12 FLD4-FLD3
KG SBI 33 56 FLD4-FLD3
KG ONBS 34 45 FLD4-FLD3
KG CIM 34 45 FLD4-FLD3
KG NTB 65 44 FLD4
KG ONBS 56 65 FLD4-FLD3
KG OFFS 32 3 FLD4
KG OFFS 66 45 FLD4
KG CIM 2 67 FLD4-FLD3
KG NTB 65 56 FLD4
KG NTB 34 87 FLD4
KG OFFS 75 34 FLD4
KG SBI 76 45 FLD4-FLD3
KG SBI 23 76 FLD4-FLD3
KG OFFS 89 78 FLD4

i want create view which the conditions are:
1. FLD5(field) is FLD4-FLD3 if FLD2 = ONBS,SBI,CIM
2. FLD5(field) is FLD4 if FLD2 = NTB, OFFS

THANKS

oh
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2002-10-30 : 05:27:44
(forum) search here for example of "CASE" statements....there's plenty of examples already here, which will solve your problem.....(it's not difficult, but you'll learn far more by searching, reading, understanding and applying what you find than if we just give you the code)

Go to Top of Page
   

- Advertisement -