Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Closed Thread
 
Thread Tools Display Modes
  #1 (permalink)  
Old January 13th, 2004, 04:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: abu dbabi, , United Arab Emirates.
Posts: 518
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sql Query Problem

I have sql query problem.

I am using two tables, EMME2, DNF

Emme2 table data like this

Fromnode tonode volume
10017 10018 1353
10017 10012 454
10017 10014 1563
10017 10016 358
……
and so on…

DNF table data like this

Fromnode tonode IPNOS Movement
10017 10018 IP1 EBU
10017 10012 IP1 EBL
10017 10014 IP1 EBT
10017 10016 IP1 EBR
100197 10098 IP2 EBU
10097 10092 IP2 EBL
……..
and so on…

I use following query

SELECT DFN.IPNos as ipNos, DFN.FromNode AS fromnode, DFN.ToNode AS tonode, emme2.Volume AS volumn, DFN.Movement
FROM DFN RIGHT OUTER JOIN
                      emme2 ON DFN.FromNode = emme2.FromNode AND DFN.ToNode = emme2.ToNode

when I run above query data retrieve like following.

IPNos movement volume
IP1 EBU 0
IP1 EBU 0
IP1 EBL 454
IP1 EBL 454
………………………….
..
IP2 EBU 17
IP2 EBU 17
IP2 EBL 846
IP2 EBL 846


I want that data should be retrieve (display) like following

IPNOS EBU EBL EBT EBR WBU WBL WBT WBR
IP-1 0 454 1563 358 33 881 1310 53
IP-2 17 846 1310 1310 125 122 120 31
IP-3 50 31 15 166 133 133 157 650
……
and so on…..

How can write the slq query so that data retrieve like above.

Please help.

Mateen








Closed Thread


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL Query Problem mike.chary SQL Server 2005 1 September 26th, 2007 06:19 AM
SQL Query problem skarthikk SQL Server 2000 1 August 7th, 2006 02:20 AM
SQL query problem - Need Help Settt Biztalk 0 September 12th, 2005 09:32 AM
Problem in SQL query liorlankri ADO.NET 1 November 7th, 2004 11:37 PM
sql query problem Baby_programmer ASP.NET 1.0 and 1.1 Basics 1 October 14th, 2004 07:13 AM



All times are GMT -4. The time now is 03:39 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.