Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDevelopment and...Development and...SQL and SQL Ser...SQL and SQL Ser...Sorting a tableSorting a table
Previous
 
Next
New Post
3/12/2010 3:35 AM
 

Hi,

I have 2 table's with sales information.
Out this tables I want to filter the monthly sales.
So far I have make this statement.

Select A1.orderdate, A2.quantity, itemdesc LEN(itemdesc) AS lenght
from nb_store_orders A1, nb_store_orderdetails A2
WHERE A1.OrderId = A2.OrderId
AND DATEPART(yyyy,A1.orderdate) = '2010' AND DATEPART(mm,A1.orderdate) = '02'
ORDER BY A2.ItemDesc ASC

The field "itemdesc" consist of an itemdescription with a partnumber connected to it
like: itemdescription.PN1234
Now I want to sort this on the last 6 chars of itemdesc. (that is the partnumber)

ODER BY SUBSTRING(A2.ItemDesc, LEN(A2.ItemDesc) - 6, 6) ASC

This is not working.
Is there anybody who can explain to me how to do this?
How to isolate the partnumber from this string?

 With regards, Ton Hermes


Art is hard work, inspiration is the cream on top of it. See my watercolors at www.watermansite.com and my enamel art at www.watermanshop.com
 
New Post
3/12/2010 4:21 AM
 
Select O.orderdate, D.quantity, D.itemdesc, SUBSTRING(D.ItemDesc, LEN(D.ItemDesc-6,6)) PartNumber FROM nb_store_orders O INNER JOIN nb_store_orderdetails O ON O.OrderId = D.OrderId WHERE DATEPART(yyyy,O.orderdate) = '2010' AND DATEPART(mm,O.orderdate) = '02' ORDER BY PartNumber ASC should work.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
3/12/2010 5:07 PM
 

How about RIGHT(ItemDesc,4)?

 
New Post
3/17/2010 3:39 AM
 

Hi,

Yes, RIGHT(itemdesc,4) works.
Thanks,

Regards, Ton


Art is hard work, inspiration is the cream on top of it. See my watercolors at www.watermansite.com and my enamel art at www.watermanshop.com
 
Previous
 
Next
HomeHomeDevelopment and...Development and...SQL and SQL Ser...SQL and SQL Ser...Sorting a tableSorting a table


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out