Maximum value we can have in in clause

Is there a limit to the maximum number of values we can have in the in clause sql_query = """SELECT * FROM table1 WHERE column1 IN %(list_of_values)s ORDER BY CASE WHEN column2 LIKE ‘a%’ THEN 1 WHEN column2 LIKE ‘b%’ THEN 2 WHEN column2 LIKE ‘c%’ THEN 3 ELSE 99 END;""" params = {‘list_of_values’: list_of_values}… Read More Maximum value we can have in in clause

Brand new to SQL, looking to find total sales on a specific day

I have the following: SELECT [Sales_Line_Item].[Sales Date], [Sales_Line_Item].[Quantity]*[Sales_Line_Item].[Unit Price] AS [Total Sales] FROM Sales_Line_Item WHERE [Sales Date] = #9/1/2020#; Which displays: I want to add the total sales together so that the result is: Sales Date Total Sales 9/1/2020 $6,276.00 Thank you for any help I wanted to use SUM(Total Sales) someway but I’m missing… Read More Brand new to SQL, looking to find total sales on a specific day

Could you please help me to find the error in my below sql code

with unmatchedTranCounts as ( select ‘rms.ordhead’ as tableName, count_big(etl_update_ts) as todayRows from rms.ordhead t1 where t1.etl_update_ts >= convert(date, getutcdate()) union all select ‘rms.shipment’ as tableName, count_big(etl_update_ts) as todayRows from rms.shipment t2 where t2.etl_update_ts >=convert(date, getutcdate()) union all select ‘rms.shipsku’ as tableName, count_big(etl_update_ts) as todayRows from rms.shipsku t3 where t3.etl_update_ts >= convert(date, getutcdate()) union all select… Read More Could you please help me to find the error in my below sql code

joining two tables eventhough the id does not display on the second table

i have two tables NAMES and NAMES_VERIFICATIONS NAMES id fname Tax 1 jack 56982 1000 Tim 32165 2321 Andrew 98956 231 Jim 11215 NAMES_VERIFICATIONS id idtype iddata 1 tax 56982 1 passport 12365 2321 tax 98956 2321 passport 65656 so if you notice there is no ID 1000 in the NAMES_VERIFICATIONS table so i want… Read More joining two tables eventhough the id does not display on the second table

Combine 2 queries together

I am struggling to work out combining a query that should give me 3 columns of Month, total_sold_products and drinks_sold_products Query 1: Select month(date), count(id) as total_sold_products from Products where date between ‘2022-01-01’ and ‘2022-12-31’ Query 2 Select month(date), count(id) as drinks_sold_products from Products where type = ‘drinks’ and date between ‘2022-01-01’ and ‘2022-12-31’ I… Read More Combine 2 queries together