How do I use another column if two rows in the first column checked are the same?
问题 I have a table that looks something like this: stones ID number snumber wt qt 1 a 11.5 13 2 c 4.0 8 3 a a1 1.0 2 4 d 0.5 1 5 b 2.0 4 6 a a2 5.0 1 7 f 3.0 6 8 a a3 5.0 10 How do I select all from stones and if the column number has rows in the column snumber only give results from snumber 's rows [otherwise use number ]? I am also trying to incorporate in my previous [working] code that selects all rows in the table that wt >= 2.5 then count all those rows as totalrows : SELECT inv.*, COUNT(*)