Last post Jan 05, 2016 08:07 AM by Nan Yu
Jan 04, 2016 11:18 AM|Hisanth|LINK
My query is
select distinct PoNo, PoDate, SupplierId, BillNo FROM Purchase_Product order by PoNo
It shows like as follows
But I need PO0001, Po0002, PO0003, PO0004.....
So, i am using
select distinct PoNo, PoDate, SupplierId, BillNo FROM Purchase_Product order by SUBSTRING(PoNo,5,1)
But it shows an error like
ORDER BY items must appear in the select list if SELECT DISTINCT is specified.
Jan 05, 2016 08:07 AM|Nan Yu|LINK
Do you want to only select the PO0001, Po0002 from the table ? try below code:
select distinct SUBSTRING(PoNo,0,7) AS PoNo FROM Purchase_Product order by PoNo