473,404 Members | 2,137 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,404 software developers and data experts.

Parameterized query from within query

Hey Guys,

I hope I didn't miss a post on this subject already.

I am using Access 2003 through ADO.

I have query 1 (MergeThisLastSeason):

SELECT m2.MemberLevelDesc, m2.CostAmt, m1.MemberLevelID, m1.SeasonID
FROM MemberLevels AS m2 INNER JOIN MemberLevels AS m1 ON
m2.CurrSeasMbrID=m1.MemberLevelID
where m1.SeasonID = [@aseasonid]

and query 2:

SELECT
Sum(InvoiceItems.ItemQty) AS SumOfItemQty,
MergeThisLastSeason.MemberLevelDesc,
MergeThisLastSeason.CostAmt,
Sum(MergeThisLastSeason.CostAmt) AS TotAmt,
InvoiceItems.PersonID, InvoiceItems.SeasonID
FROM MergeThisLastSeason
INNER JOIN InvoiceItems ON
MergeThisLastSeason.MemberLevelID=InvoiceItems.Mem berLevelID
WHERE MergeThisLastSeason.SeasonID=InvoiceItems.SeasonID
GROUP BY MergeThisLastSeason.MemberLevelDesc,
MergeThisLastSeason.CostAmt, InvoiceItems.PersonID,
InvoiceItems.PersonID, InvoiceItems.SeasonID;

I used to have [@aseasonid] hard coded to a value but now I want it as
a parameter

How do I get query 2 to execute query 1 (MergeThisLastSeason) with a
parameter?

Dazed and confused,

~Gina_M~
Feb 26 '08 #1
1 1535
On Feb 25, 10:36*pm, Gina_Marano <ginals...@gmail.comwrote:
Hey Guys,

I hope I didn't miss a post on this subject already.

I am using Access 2003 through ADO.

I have query 1 (MergeThisLastSeason):

SELECT m2.MemberLevelDesc, m2.CostAmt, m1.MemberLevelID, m1.SeasonID
FROM MemberLevels AS m2 INNER JOIN MemberLevels AS m1 ON
m2.CurrSeasMbrID=m1.MemberLevelID
where m1.SeasonID = [@aseasonid]

and query 2:

SELECT
Sum(InvoiceItems.ItemQty) AS SumOfItemQty,
MergeThisLastSeason.MemberLevelDesc,
MergeThisLastSeason.CostAmt,
Sum(MergeThisLastSeason.CostAmt) AS TotAmt,
InvoiceItems.PersonID, InvoiceItems.SeasonID
FROM MergeThisLastSeason
INNER JOIN InvoiceItems ON
MergeThisLastSeason.MemberLevelID=InvoiceItems.Mem berLevelID
WHERE MergeThisLastSeason.SeasonID=[@seasonid]
GROUP BY MergeThisLastSeason.MemberLevelDesc,
MergeThisLastSeason.CostAmt, InvoiceItems.PersonID,
InvoiceItems.PersonID, InvoiceItems.SeasonID;

I used to have [@aseasonid] hard coded to a value but now I want it as
a parameter

How do I get query 2 to execute query 1 (MergeThisLastSeason) *with a
parameter?

Dazed and confused,

~Gina_M~
please disregard thanks much!!!
Feb 26 '08 #2

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

Similar topics

1
by: gary b | last post by:
Hello When I use a PreparedStatement (in jdbc) with the following query: SELECT store_groups_id FROM store_groups WHERE store_groups_id IS NOT NULL AND type = ? ORDER BY group_name
8
by: deko | last post by:
I'm trying to open a Recordset based on a parameterized query. I'm kind of new to parameterized queries, so I'm sure I'm missing something simple. Set qdfs = db.QueryDefs Set qdf =...
2
by: deko | last post by:
Is it possible to build a parameterized query from another parameterized query? I've tried two variations of this and can't seem to get it to work (using DAO). Any suggestions welcome! I...
1
by: Jorell | last post by:
Hey everyone, I am currently using Microsofts DataAccess Application block ( SQLHelper ) and what I want to do is use a parameterized query instead of just SQL. I can not use stored procedures,...
11
by: anony | last post by:
Hello, I can't figure out why my parameterized query from an ASP.NET page is dropping "special" characters such as accented quotes & apostrophes, the registered trademark symbol, etc. These...
2
by: JSheble | last post by:
After building a parameterized ADO query, is there a method or a statement where you could see the actual query, with the parameterized values included?? -- Using Opera's revolutionary e-mail...
8
by: Roland Hall | last post by:
In Access you use "*" + + "*", + can be replaced with & Calling a parameterized query in Access requires % be used in place of *, however, all that I have read show dynamic SQL passed to Access: ...
1
by: TF | last post by:
This group came through for me last time so here we go again. My page shows paint colors, brand name, product code, etc in a gridview with the background matching the paint color. Several links on...
3
by: xlar54 | last post by:
Is there a way to see the exact SQL being generated from a parameterized query? I am using this technique but am getting some strange SQL errors during execution and I would like to see the final...
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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.