Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8126589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T07:12:04+00:00 2026-06-06T07:12:04+00:00

I have this two tables from my program to manage stock: Articulos (items): id_articulo

  • 0

I have this two tables from my program to manage stock:

Articulos (items):

id_articulo (id_item), nombre (name), tipo (kind)

Salidas (shipment):

id_articulo (id_item), cant_sale (shipment amount), imp_total (total
cost), almacen_destino (shipemt stock destiny), date

I was asked to do a static list of products so they will always show the same items in the same order where the item kind (tipo) =something

when i want to do a search to an specific shipment stock desiny (almacen_destino) between dates i cant get all the items with the same kind (tipo) because they were not shipped

this is the query i have so far:

select a.id_articulo, sum(s.cant_sale) as Cant_sale, sum(s.imp_total) as Imp_total
from articulos a left join salidas s
on a.id_articulo=s.id_articulo
WHERE a.tipo='EMPAQUES'
and FECHA BETWEEN '06/06/2012' AND '12/06/2012'
and s.almacen_destino like 'CERRO COLORADO'
group by a.id_articulo

It shows only the shipped items to that stock destiny where tipo (kind)=Empaques between those dates, ill like to show the same information plus all the other items with the same kind (tipo) that where not shipped even if shipment amount and total cost is null.

In advance, Thank you.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T07:12:07+00:00Added an answer on June 6, 2026 at 7:12 am

    Putting filter criteria on the outer table converts your outer join to an inner join. Did you try:

    SELECT 
      a.id_articulo, 
      SUM(s.cant_sale) AS Cant_sale, 
      SUM(s.imp_total) AS Imp_total
    FROM
      dbo.articulos AS a 
    LEFT OUTER JOIN
      dbo.salidas AS s
      ON a.id_articulo = s.id_articulo
      AND s.almacen_destino = 'CERRO COLORADO'
      AND s.FECHA BETWEEN '20120606' AND '20120612'
    WHERE a.tipo = 'EMPAQUES'
    GROUP BY a.id_articulo;
    

    I guessed on a few things here:

    • FECHA is in salidas – if not, then move that AND to the WHERE clause.
    • your dates are d/m/y. Please always use unambiguous date formats – you may be in the UK or Canada, but not everyone in your audience is, and we are not able to read your mind.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table with two columns (varchar from, varchar to). This table represents connections
I have this two tables: Table A ID TYPE SDATE EDATE RATING 1 M
I have two tables: This is table1: product_id|product_desc|product_name|product_s_desc This is table2: product_price_id|product_id|product_price Now I
I have two tables which looks something like this Table Queue int ID; string
I have two tables like of this structure: content (content_id, content_type, user_id, time, comment_count)
I have two tables associated by FK. Table student is mapped like this: @Entity
I have two tables Department and Employee . Department table looks like this: ID
Let's say I have two tables that look like this: TH TH TH TH
So I have two tables students (PK sID) and mentors (PK pID). This query
i have two tables, program and event. what i am trying to do is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.