473,396 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

reference to parent qry

hi,

this is my sql code.
-----start code-----
SELECT Reeksen.ReeksNR, Reeksen.ReeksText, Count(Strips.Titel) AS
NBTitel,

(SELECT Count(strips.Titel) AS AantalVanTitel FROM (Reeksen INNER JOIN
Strips ON Reeksen.ReeksNR = Strips.ReeksNR) INNER JOIN Pictures ON
Strips.Uniek = Pictures.Uniek where reeksen.ReeksNR=11) AS AantalPic

FROM Reeksen INNER JOIN Strips ON Reeksen.ReeksNR = Strips.ReeksNR
GROUP BY Reeksen.ReeksNR, Reeksen.ReeksText;
-----end code-----

somewhere in the middle I need to reference to Reeksen.ReeksNR, the
first field in the statement. like now I always have the same value
for each row. and it shout be different for every row. if I change it
into Reeksen.ReeksNR it always returns the nubre of all records in the
table. Someone has I solution

Thanks Jan
Jun 27 '08 #1
6 1284
JR
Sorry in the middel where the 11 stands

<ja********@gmail.comschreef in bericht
news:9a**********************************@2g2000hs n.googlegroups.com...
hi,

this is my sql code.
-----start code-----
SELECT Reeksen.ReeksNR, Reeksen.ReeksText, Count(Strips.Titel) AS
NBTitel,

(SELECT Count(strips.Titel) AS AantalVanTitel FROM (Reeksen INNER JOIN
Strips ON Reeksen.ReeksNR = Strips.ReeksNR) INNER JOIN Pictures ON
Strips.Uniek = Pictures.Uniek where reeksen.ReeksNR=11) AS AantalPic

FROM Reeksen INNER JOIN Strips ON Reeksen.ReeksNR = Strips.ReeksNR
GROUP BY Reeksen.ReeksNR, Reeksen.ReeksText;
-----end code-----

somewhere in the middle I need to reference to Reeksen.ReeksNR, the
first field in the statement. like now I always have the same value
for each row. and it shout be different for every row. if I change it
into Reeksen.ReeksNR it always returns the nubre of all records in the
table. Someone has I solution

Thanks Jan
Jun 27 '08 #2
On Tue, 22 Apr 2008 06:50:47 -0700 (PDT), ja********@gmail.com wrote:

If I understand you correctly you need to reference the parent query
from the top query, and they both use the same tablename "Reeksen".

Simply use an Alias in the subquery:
.... from Reeksen as ReeksenSub
so you can write things like:
.... where Reeksen.SomeField = ReeksenSub.SomeField

-Tom.
>hi,

this is my sql code.
-----start code-----
SELECT Reeksen.ReeksNR, Reeksen.ReeksText, Count(Strips.Titel) AS
NBTitel,

(SELECT Count(strips.Titel) AS AantalVanTitel FROM (Reeksen INNER JOIN
Strips ON Reeksen.ReeksNR = Strips.ReeksNR) INNER JOIN Pictures ON
Strips.Uniek = Pictures.Uniek where reeksen.ReeksNR=11) AS AantalPic

FROM Reeksen INNER JOIN Strips ON Reeksen.ReeksNR = Strips.ReeksNR
GROUP BY Reeksen.ReeksNR, Reeksen.ReeksText;
-----end code-----

somewhere in the middle I need to reference to Reeksen.ReeksNR, the
first field in the statement. like now I always have the same value
for each row. and it shout be different for every row. if I change it
into Reeksen.ReeksNR it always returns the nubre of all records in the
table. Someone has I solution

Thanks Jan
Jun 27 '08 #3
On Tue, 22 Apr 2008 19:58:19 -0700, Tom van Stiphout
<no*************@cox.netwrote:

Oops. I meant "... from the sub query ..."
-Tom.

>On Tue, 22 Apr 2008 06:50:47 -0700 (PDT), ja********@gmail.com wrote:

If I understand you correctly you need to reference the parent query
from the top query, and they both use the same tablename "Reeksen".

Simply use an Alias in the subquery:
... from Reeksen as ReeksenSub
so you can write things like:
... where Reeksen.SomeField = ReeksenSub.SomeField

-Tom.
>>hi,

this is my sql code.
-----start code-----
SELECT Reeksen.ReeksNR, Reeksen.ReeksText, Count(Strips.Titel) AS
NBTitel,

(SELECT Count(strips.Titel) AS AantalVanTitel FROM (Reeksen INNER JOIN
Strips ON Reeksen.ReeksNR = Strips.ReeksNR) INNER JOIN Pictures ON
Strips.Uniek = Pictures.Uniek where reeksen.ReeksNR=11) AS AantalPic

FROM Reeksen INNER JOIN Strips ON Reeksen.ReeksNR = Strips.ReeksNR
GROUP BY Reeksen.ReeksNR, Reeksen.ReeksText;
-----end code-----

somewhere in the middle I need to reference to Reeksen.ReeksNR, the
first field in the statement. like now I always have the same value
for each row. and it shout be different for every row. if I change it
into Reeksen.ReeksNR it always returns the nubre of all records in the
table. Someone has I solution

Thanks Jan
Jun 27 '08 #4
JR
I found some of that info on the net. wat i was missing in all that info was
a way how I must do it. I diden'tonderstand there examples . So how do I
give that query another name

Tom van Stiphout" <no*************@cox.netschreef in bericht
..news:02********************************@4ax.com. ..
On Tue, 22 Apr 2008 19:58:19 -0700, Tom van Stiphout
<no*************@cox.netwrote:

Oops. I meant "... from the sub query ..."
-Tom.

>>On Tue, 22 Apr 2008 06:50:47 -0700 (PDT), ja********@gmail.com wrote:

If I understand you correctly you need to reference the parent query
from the top query, and they both use the same tablename "Reeksen".

Simply use an Alias in the subquery:
... from Reeksen as ReeksenSub
so you can write things like:
... where Reeksen.SomeField = ReeksenSub.SomeField

-Tom.
>>>hi,

this is my sql code.
-----start code-----
SELECT Reeksen.ReeksNR, Reeksen.ReeksText, Count(Strips.Titel) AS
NBTitel,

(SELECT Count(strips.Titel) AS AantalVanTitel FROM (Reeksen INNER JOIN
Strips ON Reeksen.ReeksNR = Strips.ReeksNR) INNER JOIN Pictures ON
Strips.Uniek = Pictures.Uniek where reeksen.ReeksNR=11) AS AantalPic

FROM Reeksen INNER JOIN Strips ON Reeksen.ReeksNR = Strips.ReeksNR
GROUP BY Reeksen.ReeksNR, Reeksen.ReeksText;
-----end code-----

somewhere in the middle I need to reference to Reeksen.ReeksNR, the
first field in the statement. like now I always have the same value
for each row. and it shout be different for every row. if I change it
into Reeksen.ReeksNR it always returns the nubre of all records in the
table. Someone has I solution

Thanks Jan
Jun 27 '08 #5
On Apr 24, 3:59*am, "JR" <xx....@xx.xxwrote:
I found some of that info on the net. wat i was missing in all that info was
a way how I must do it. I diden'tonderstand there examples . So how do I
give that query *another name

Tom van Stiphout" <no.spam.tom7...@cox.netschreef in bericht
.news:02********************************@4ax.com.. .
On Tue, 22 Apr 2008 19:58:19 -0700, Tom van Stiphout
<no.spam.tom7...@cox.netwrote:
Oops. I meant "... from the sub query ..."
-Tom.
>On Tue, 22 Apr 2008 06:50:47 -0700 (PDT), jan.sch...@gmail.com wrote:
>If I understand you correctly you need to reference the parent query
from the top query, and they both use the same tablename "Reeksen".
>Simply use an Alias in the subquery:
... from Reeksen as ReeksenSub
so you can write things like:
... where Reeksen.SomeField = ReeksenSub.SomeField
>-Tom.
>>hi,
>>this is my sql code.
-----start code-----
SELECT Reeksen.ReeksNR, Reeksen.ReeksText, Count(Strips.Titel) AS
NBTitel,
>>(SELECT Count(strips.Titel) AS AantalVanTitel FROM (Reeksen INNER JOIN
Strips ON Reeksen.ReeksNR = Strips.ReeksNR) INNER JOIN Pictures ON
Strips.Uniek = Pictures.Uniek where reeksen.ReeksNR=11) AS AantalPic
>>FROM Reeksen INNER JOIN Strips ON Reeksen.ReeksNR = Strips.ReeksNR
GROUP BY Reeksen.ReeksNR, Reeksen.ReeksText;
-----end code-----
>>somewhere in the middle I need to reference to Reeksen.ReeksNR, the
first field in the statement. like now I always have the same value
for each row. and it shout be different for every row. if I change it
into Reeksen.ReeksNR it always returns the nubre of all records in the
table. Someone has I solution
>>Thanks Jan- Hide quoted text -

- Show quoted text -
because you reference the table Reeksen twice, you need to use an
alias to differentiate between the two, see references to ReeksenSub
below

SELECT ReeksenSub.ReeksNR, ReeksenSub.ReeksText, Count(Strips.Titel)
AS
NBTitel,
(SELECT Count(strips.Titel) AS AantalVanTitel FROM (Reeksen INNER
JOIN
Strips ON Reeksen.ReeksNR = Strips.ReeksNR) INNER JOIN Pictures ON
Strips.Uniek = Pictures.Uniek where reeksen.ReeksNR=11) AS AantalPic
FROM Reeksen as ReeksenSub INNER JOIN Strips ON ReeksenSub.ReeksNR =
Strips.ReeksNR
GROUP BY ReeksenSub.ReeksNR, ReeksenSub.ReeksText;

Jun 27 '08 #6
JR

"Roger" <le*********@natpro.comschreef in bericht
news:27**********************************@m3g2000h sc.googlegroups.com...
On Apr 24, 3:59 am, "JR" <xx....@xx.xxwrote:
I found some of that info on the net. wat i was missing in all that info
was
a way how I must do it. I diden'tonderstand there examples . So how do I
give that query another name

Tom van Stiphout" <no.spam.tom7...@cox.netschreef in bericht
.news:02********************************@4ax.com.. .
On Tue, 22 Apr 2008 19:58:19 -0700, Tom van Stiphout
<no.spam.tom7...@cox.netwrote:
Oops. I meant "... from the sub query ..."
-Tom.
>On Tue, 22 Apr 2008 06:50:47 -0700 (PDT), jan.sch...@gmail.com wrote:
>If I understand you correctly you need to reference the parent query
from the top query, and they both use the same tablename "Reeksen".
>Simply use an Alias in the subquery:
... from Reeksen as ReeksenSub
so you can write things like:
... where Reeksen.SomeField = ReeksenSub.SomeField
>-Tom.
>>hi,
>>this is my sql code.
-----start code-----
SELECT Reeksen.ReeksNR, Reeksen.ReeksText, Count(Strips.Titel) AS
NBTitel,
>>(SELECT Count(strips.Titel) AS AantalVanTitel FROM (Reeksen INNER JOIN
Strips ON Reeksen.ReeksNR = Strips.ReeksNR) INNER JOIN Pictures ON
Strips.Uniek = Pictures.Uniek where reeksen.ReeksNR=11) AS AantalPic
>>FROM Reeksen INNER JOIN Strips ON Reeksen.ReeksNR = Strips.ReeksNR
GROUP BY Reeksen.ReeksNR, Reeksen.ReeksText;
-----end code-----
>>somewhere in the middle I need to reference to Reeksen.ReeksNR, the
first field in the statement. like now I always have the same value
for each row. and it shout be different for every row. if I change it
into Reeksen.ReeksNR it always returns the nubre of all records in the
table. Someone has I solution
>>Thanks Jan- Hide quoted text -

- Show quoted text -
because you reference the table Reeksen twice, you need to use an
alias to differentiate between the two, see references to ReeksenSub
below

SELECT ReeksenSub.ReeksNR, ReeksenSub.ReeksText, Count(Strips.Titel)
AS
NBTitel,
(SELECT Count(strips.Titel) AS AantalVanTitel FROM (Reeksen INNER
JOIN
Strips ON Reeksen.ReeksNR = Strips.ReeksNR) INNER JOIN Pictures ON
Strips.Uniek = Pictures.Uniek where reeksen.ReeksNR=11) AS AantalPic
FROM Reeksen as ReeksenSub INNER JOIN Strips ON ReeksenSub.ReeksNR =
Strips.ReeksNR
GROUP BY ReeksenSub.ReeksNR, ReeksenSub.ReeksText;
thanks. now I get it

Jun 27 '08 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Alex | last post by:
Is there a way to reference the "parent" object that creates a child object from within the child object? Or do I have to pass a reference to the parent object to the constructor of the child...
5
by: JC | last post by:
hi all First of all, sorry for my (bad) english, I have a javascript: <script type="text/javascript"> <!-- function gointo(td,color){td.style.cursor='default';td.bgColor=color;} function...
2
by: Jim Red | last post by:
hello first of all, i know, there are no classes in javascript. but i will use that word for better understanding of my question. here we go. i have three classes and need a reference to the...
12
by: marcadonis | last post by:
Hi! Does anybody know of a way that I can keep a reference to an object that I can then reuse? I tried various approaches using navigator, but these all fail in an iframe due to premission...
2
by: Sidorf | last post by:
Hi It's a little hard for me to explain my problem, but i'll try. I have an application in which i have a ManagerClass, many ClientClass-es ans some ControlClass. The ManagerClass creates one...
2
by: Roy | last post by:
Ok, this is incredibly annoying. Below I have an ImageButton and it's ImageButton_Click sub. See the 6 response.writes? The output for them is displayed below in asterisks. Question: What part of...
1
by: John A Grandy | last post by:
Let's say I have an .aspx Page instance derived from class "MyPage" (which of course inherits from System.Web.UI.Page). On the .aspx Page , I have "uc1", an instance of a UserControl dervived...
16
by: John | last post by:
Hi I have posted this question several times but have received no reply. I have a main form which contains a panel which in turn contains a child form, like this; MainForm->MyPanel->ChildForm....
1
by: Brian P | last post by:
I have a class, Folder, that I want to hold a reference to its parent Folder as well as its subfolders. I'm using List<Folder> to hold its list of sub folders. What I want to do is when a...
7
by: vunet | last post by:
I am still not clear about how to reference an object within another object to pass first object to a function: var Parent = { myFunc : function(){ alert("Parent = "+this) }, Child : { //how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.