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
 CREATE VIEW question

Author  Topic 

smartin_999
Starting Member

8 Posts

Posted - 2010-02-11 : 07:54:58
hi there,

i have a problem with a create view and want to ask if the following thing is possible:

i have three tables:

A
B
C

Table A is customer-master and has field customer-number which is UNIQUE.

Table B and C are tables with up to 3 rows per customer and there i have tel.numbers (table B) and email-adresses (table C) stored.
so if the customer has 2 tel.numbers i have 2 records in table B.

now i want to create a view with CREATE VIEW with following fields:

customer-number (from table A)
name (from table A)
Tel.number 1 (from table B)
Tel.number 2 (from table B)
Tel.number 3 (from table B)
Email 1 (from table C)
Email 2 (from table C)
Email 3 (from table C)

so i want to have only ONE(!!) record per customer with the different Tel.numbers in the same record. if there is only one number or none, there should be blank in the field.

is this possible ??? i can't use a programming language there, i MUST do it with create view statement. pls don't ask me why ;-))

reg, Martin

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-11 : 08:00:31
are you using sql 2005?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

smartin_999
Starting Member

8 Posts

Posted - 2010-02-11 : 08:03:43
quote:
Originally posted by visakh16

are you using sql 2005?



no its a 'special' sql on an ibm iseries.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-11 : 08:09:36
quote:
Originally posted by smartin_999

quote:
Originally posted by visakh16

are you using sql 2005?



no its a 'special' sql on an ibm iseries.


what's that?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-02-11 : 08:18:21
If you are not using SQL Server, post your question at related forum

Madhivanan

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

smartin_999
Starting Member

8 Posts

Posted - 2010-02-11 : 08:22:41
quote:
Originally posted by visakh16

quote:
Originally posted by smartin_999

quote:
Originally posted by visakh16

are you using sql 2005?



no its a 'special' sql on an ibm iseries.


what's that?




A special server. but the syntax of SQL should be the same everywhere, so i only want to know if it is possible.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-02-11 : 08:27:46
quote:
Originally posted by smartin_999

quote:
Originally posted by visakh16

quote:
Originally posted by smartin_999

quote:
Originally posted by visakh16

are you using sql 2005?



no its a 'special' sql on an ibm iseries.


what's that?




A special server. but the syntax of SQL should be the same everywhere, so i only want to know if it is possible.


Nope thats not true. there are many features that are specific to MS SQL Server and it may not work in your case. This is a MS SQL Server forum and hence solutions provided here are guaranteed to work only in SQL Server. So you may be better off posting this in your relevant forums.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -