[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

5.8

how to join to queries

Asked by ammartahir1978 in PL / SQL, SQL Query Syntax, SQL Server 2005

Tags: microsoft, sql server

hi everyone,

i have two queries one gives me the stock units available and the other one give me the sales of the products, what i want is to join them so that i can see the following

the total of a product sold and the free stock available for that
/*STOCK AVAILABLE*/
select b.branch_desc,pm.alt_code1,c.colour_code,s.sizes_desc, Sum(ph.stock_units_free) FREE_STOCK,
Sum(ph.stock_units_it) IT_STOCK,Sum(ph.stock_units_qc) QC_STOCK
from product_history ph, product_master pm, product_detail pd,sizes s, colour c,branch b
where ph.week_selector = '1100250'
and ph.sku_id = pd.sku_id
and pd.product_id = pm.prod_id
and s.sizes_id = pd.sizes_id
and c.colour_id = pd.colour_id
and pm.alt_code1 like '01Q03'
and b.branch_id = ph.branch_id
group by pm.alt_code1,c.colour_code,s.sizes_desc,b.branch_desc
order by b.branch_desc,pm.alt_code1

/*STOCK SOLD*/

Select b.branch_desc,pm.alt_code1,c.colour_code,s.sizes_desc,sum(ptsd.units) as SOLD_UNITS
from anal_level al,pm_trans_header pth, pm_trans_sku_details ptsd,branch b,sizes s,colour c,product_detail pd, product_master pm
where pth.txn_date_time between '06-01-2008 00:00:00.000'and '09-01-2008 23:59:59.999'
and pth.receipt_id = ptsd.receipt_id
and pth.branch_id = b.branch_id
and ptsd.sku_id = pd.sku_id
and pd.product_id = pm.prod_id
and al.j_code = pm.j_code_link
and al.level_no = 4
and pd.colour_id = c.colour_id
and pd.sizes_id = s.sizes_id
and pth.flag = 1
and pth.transaction_void = 0
and ptsd.flag = 1
group by pm.alt_code1,c.colour_code,s.sizes_desc,b.branch_desc
order by b.branch_desc,pm.alt_code1

how can i merge these both queries to get the results, please help
 
Related Solutions
Keywords: how to join to queries
 
Loading Advertisement...
 
[+][-]01/10/08 08:02 AM, ID: 20628146Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: PL / SQL, SQL Query Syntax, SQL Server 2005
Tags: microsoft, sql server
Sign Up Now!
Solution Provided By: sonicefu
Participating Experts: 2
Solution Grade: A
 
[+][-]01/10/08 08:05 AM, ID: 20628176Assisted Solution

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 30-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]01/10/08 08:05 AM, ID: 20628183Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/10/08 08:06 AM, ID: 20628190Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/10/08 08:07 AM, ID: 20628206Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/10/08 08:09 AM, ID: 20628218Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/10/08 08:16 AM, ID: 20628294Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/10/08 08:20 AM, ID: 20628341Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/10/08 08:24 AM, ID: 20628385Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/10/08 08:35 AM, ID: 20628487Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/10/08 08:38 AM, ID: 20628513Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/10/08 08:39 AM, ID: 20628520Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/10/08 08:40 AM, ID: 20628540Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/10/08 08:44 AM, ID: 20628588Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/10/08 08:45 AM, ID: 20628595Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/10/08 08:48 AM, ID: 20628637Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/10/08 08:50 AM, ID: 20628661Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]01/10/08 08:53 AM, ID: 20628691Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01/10/08 10:30 AM, ID: 20629646Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 / EE_QW_2_20070628