Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 13th, 2004, 05:31 AM
Friend of Wrox
 
Join Date: Jun 2003
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













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 8th, 2004 12:37 AM
sql query problem Baby_programmer ASP.NET 1.0 and 1.1 Basics 1 October 14th, 2004 07:13 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.