Skip to content
Advertisement

Tag: sql-order-by

SQL Order By on multiple columns containing Nulls

I have a table containing multiple columns, and I want to order by three of the columns within the table. I want to order by lot, then unit, and lastly number. Lot and Unit can contain nulls (need them listed at the bottom) whereas Number column does not contain Null. I’ve tried a bunch of case statements but its not

there is a way to order empty element like null element?

I need to order a column and there are a lot of elements null or empty.The problem is null element are ordered differente from null element The result about is that employees with name==null are the first position, after there are the elements with name!=null (are a real name) and at the end there are the elements with name empty.

mysql order by field row display even if empty

I’ve two tables( bom and bom_parts). Need to inner join and display stock_deduct,GRN_id,part_id fields. Table 1 (bom): Table 2 (bom_parts): MySql query: Query Result: Expected Result: Even if the part_id field is empty in this case 8, 6, I just want to display the part_id with the stock_deduct field as 1 in the result as mentioned below. Stock_deduct GRN_id part_id

Advertisement