Query returned no results message

Sarhan, Amr 0 Reputation points
2024-01-24T17:42:13.8766667+00:00
DROP TABLE IF EXISTS userdb_sarhan_aa.UPI_Weekly_Analysis_FY24;
CREATE TABLE userdb_sarhan_aa.UPI_Weekly_Analysis_FY24 as
SELECT calendar_year_week,calendar_date, material, plant, BUoM_Total_Plant_Stock_T
,BUoM_Red_R,BUoM_Orange_O,BUoM_Amber_M,BUoM_SND_Excess_D,BUoM_Launch_Excess_L,BUoM_Excess_Y
FROM ap_inventory.inventory_fct_emea
WHERE calday > 20230700 AND calday < 20240700 
AND region = "EUE"
;

Community Center | Not monitored
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Michael Taylor 60,326 Reputation points
    2024-01-24T18:37:34.1333333+00:00

    We have no visibility into your database so we have no way of confirming what is wrong here. You need to diagnose this yourself. Start with the simplest query.

    SELECT * FROM ap_inventory.inventory_fct_emea
    

    Do you get results back? If so then add your conditions one by one. I'd start with region = 'EUE'. Notice that the string is in single quotes, not double quotes. Did you get any data back? If not then check your table and confirm there are any rows with a region of EUE. Note that depending upon your database there could be empty spaces on either side or other things causing the condition to be false. Check all that out.

    If the above query works then add in your final condition. Note that we have no idea what type calday is. If it is an integral value then, again, check the table to see if you have any rows that match. If the column is a date/datetime then the integral conversion probably isn't right, use a date literal instead. Also consider using BETWEEN instead of the relational operators but note that it is inclusive so your original relation would be something like calday BETWEEN 20230701 AND 20240630 I'm thinking.

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.