Click here to Skip to main content
14,869,843 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how can i get mutiple column values from multiple sql views?
Posted

Learn JOINS in SQL and use it:
http://www.w3schools.com/sql/sql_join.asp[^]
   
Comments
[no name] 13-Sep-12 2:25am
   
that cannot be done by JOIN, because there is only one table for this.

Coulumns are userName, processDate, processID

I need to get each user's total proccesses for each day. So the user names cannot be in rows, it has to be in columns
[no name] 13-Sep-12 2:26am
   
Actually i need the out put as below,

date userA userB userC

01/09 10 12 3
02/09 12 3 5
Hi,

try like this,
SQL
SELECT V1.col1, V2.col2, V3.col3 FROM View1 V1 
INNER JOIN View2 V2 ON V1.Col1 = V2.Col1 
INNER JOIN View3 V3 ON V1.Col2 = V3.col3


hope it works.
   
Comments
[no name] 13-Sep-12 2:31am
   
Coulumns are userName, processDate, processID


Coulumns are,

userName processDate processID

userA 09/01 0001
userA 09/01 0002
userB 09/01 0003
I need to get each user's total proccesses for each day. So the user names cannot be in rows, it has to be in columns

Actually i need the out put as below,

date userA userB userC

01/09 10 12 3
02/09 12 3 5
that was quite easy, i just created some views & joined them!
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900