SQL help, organizing some user input data with automatic data over shifts

I think it is done for now.

MS SQL
it is a named query

Row_Number() over (partition by  particularMachine order by Hours desc) as particularMachine2,

now I see an error, instead of hours, should prob be t_stamp

Should not be necessary to cast as float to get decimals, though not like you'll see any difference in performance.
image

was rounding out decimals when I had them as integers

not sure

1 Like

I am having an issue with the join.

I was using left join.

autoTable has results for a shift
manualTable skipped that shift
every join I try, I get no values from the autoTable for that shift though

in the join I have similar to:
autoTable.shift = manualTable.shift

So I thought join outer would show me left table entries and nulls in the right table columns

If I remove the shift match, then I see values, but they match incorrectly


I think I am going to do a ticket.
Probably something in there that is obvious if I could show the whole query as it is.


figured it out,
was filtering in where by hours>0, and that comes form right side table

Can you use https://www.db-fiddle.com/ - recreate your table schemas and add some fake data, click save, and then post the link - it will allow us to actually play with your tables. Well make it a lot easier to help you with your query as right now we are doing it blind - we don’t know what your schema is or how the table relate exactly etc.

1 Like

how does that site work?
I prob can, does it save subsets of data and querie somehow or is it just like going to be wiped out when you leave it?

Oh my query above was such a work around.

I was using subqueries, unions, groups, and cases much more effectively just a few months later that same year even. That query above is so embarrassing now.

Nah.... Just a sign of growth and that is a positive not a negative. Perhaps it was a workaround, but that just means you were able to find a solution.

Two signs of a good engineer is being able to solve a problem despite not having the prerequisite knowledge, and recognizing that is also a problem and taking the opportunity to grow.

3 Likes