Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Query table using column within table

3 posts in General Discussion Last posting was on 2006-12-27 16:02:57.0Z
nickedw Posted on 2006-12-24 01:20:27.0Z
Sender: 4106.4582fbf2.1804289383@sybase.com
From: nickedw
Newsgroups: ianywhere.public.general
Subject: Query table using column within table
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <458de3eb.4cb0.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 23 Dec 2006 18:20:27 -0700
X-Trace: forums-1-dub 1166926827 10.22.241.41 (23 Dec 2006 18:20:27 -0700)
X-Original-Trace: 23 Dec 2006 18:20:27 -0700, 10.22.241.41
Lines: 29
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:5775
Article PK: 1774

I have 2 tables as follows:

1. Charge Table:

cid amount dept
--- ------ ----
101 100.00 10
102 200.00 99

2. department table:

id desc eqvid
-- -------- -----
10 desc10 10
20 desc20 20
99 desc99 10


i need to list the charges with the equivalent department
desc, as follows:

cid amount dept deptname
--- ------ -- --------
101 100.00 10 desc10
102 200.00 99 desc10

i would appreciate any help with this
tia
nickedw


Breck Carter [Team iAnywhere] Posted on 2006-12-24 13:18:58.0Z
From: "Breck Carter [Team iAnywhere]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: Query table using column within table
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <ge2to21ddkds028o3lc5lrsbvb06s8q0c0@4ax.com>
References: <458de3eb.4cb0.1681692777@sybase.com>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: bcarter.sentex.ca
X-Original-NNTP-Posting-Host: bcarter.sentex.ca
Date: 24 Dec 2006 06:18:58 -0700
X-Trace: forums-1-dub 1166969938 64.7.134.118 (24 Dec 2006 06:18:58 -0700)
X-Original-Trace: 24 Dec 2006 06:18:58 -0700, bcarter.sentex.ca
Lines: 52
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:5776
Article PK: 1770

Merry Christmas!

SELECT Charge.cid,
Charge.amount,
Charge.dept,
eqv_department."desc" AS deptname
FROM Charge
INNER JOIN department AS base_department
ON base_department.id = Charge.dept
INNER JOIN department AS eqv_department
ON eqv_department.id = base_department.eqvid
ORDER BY Charge.cid;

On 23 Dec 2006 18:20:27 -0700, nickedw wrote:

>I have 2 tables as follows:
>
>1. Charge Table:
>
>cid amount dept
>--- ------ ----
>101 100.00 10
>102 200.00 99
>
>2. department table:
>
>id desc eqvid
>-- -------- -----
>10 desc10 10
>20 desc20 20
>99 desc99 10
>
>
>i need to list the charges with the equivalent department
>desc, as follows:
>
>cid amount dept deptname
>--- ------ -- --------
>101 100.00 10 desc10
>102 200.00 99 desc10
>
>i would appreciate any help with this
>tia
>nickedw

--
Breck Carter [Team iAnywhere]
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
The book: http://www.risingroad.com/SQL_Anywhere_Studio_9_Developers_Guide.html
breck.carter@risingroad.com


nickedw Posted on 2006-12-27 16:02:57.0Z
Sender: 4cc0.458de47b.1804289383@sybase.com
From: nickedw
Newsgroups: ianywhere.public.general
Subject: Re: Query table using column within table
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <4592a741.2082.1681692777@sybase.com>
References: <ge2to21ddkds028o3lc5lrsbvb06s8q0c0@4ax.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 27 Dec 2006 09:02:57 -0700
X-Trace: forums-1-dub 1167238977 10.22.241.41 (27 Dec 2006 09:02:57 -0700)
X-Original-Trace: 27 Dec 2006 09:02:57 -0700, 10.22.241.41
Lines: 55
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:5777
Article PK: 1772


> Merry Christmas!
Thanks! your help and quick response is appreciated.
>
> SELECT Charge.cid,
> Charge.amount,
> Charge.dept,
> eqv_department."desc" AS deptname
> FROM Charge
> INNER JOIN department AS base_department
> ON base_department.id = Charge.dept
> INNER JOIN department AS eqv_department
> ON eqv_department.id = base_department.eqvid
> ORDER BY Charge.cid;
>
>
> On 23 Dec 2006 18:20:27 -0700, nickedw wrote:
>
> >I have 2 tables as follows:
> >
> >1. Charge Table:
> >
> >cid amount dept
> >--- ------ ----
> >101 100.00 10
> >102 200.00 99
> >
> >2. department table:
> >
> >id desc eqvid
> >-- -------- -----
> >10 desc10 10
> >20 desc20 20
> >99 desc99 10
> >
> >
> >i need to list the charges with the equivalent department
> >desc, as follows:
> >
> >cid amount dept deptname
> >--- ------ -- --------
> >101 100.00 10 desc10
> >102 200.00 99 desc10
> >
> >i would appreciate any help with this
> >tia
> >nickedw
>
> --
> Breck Carter [Team iAnywhere]
> RisingRoad SQL Anywhere and MobiLink Professional Services
> www.risingroad.com
> The book:
>
http://www.risingroad.com/SQL_Anywhere_Studio_9_Developers_Guide.html
> breck.carter@risingroad.com