Hi Everyone,
I'm trying to create a rank query from access to rank the lowest cost as shown below. Below are all the fields in my table and I am ranking them based on ORG STATE and DEST PROV. The example below is two transportation carriers going to two different origin/destination (CA to AB and CA to ON). I need to rank the lowest cost based on these pairings. I would appreciate if someone can provide me the sql query for this. Thanks in advance
[TABLE="width: 620"]
<colgroup><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Carrier Name [/TD]
[TD]ORG STATE[/TD]
[TD]DEST PROV[/TD]
[TD]# of shipments[/TD]
[TD]Total Cost[/TD]
[TD]Rank[/TD]
[/TR]
[TR]
[TD]Carrier A[/TD]
[TD]CA[/TD]
[TD]AB[/TD]
[TD]293[/TD]
[TD]$50,000[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Carrier B[/TD]
[TD]CA[/TD]
[TD]AB[/TD]
[TD]293[/TD]
[TD]$75,000[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Carrier A[/TD]
[TD]CA[/TD]
[TD]ON[/TD]
[TD]150[/TD]
[TD]$42,000[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Carrier B[/TD]
[TD]CA[/TD]
[TD]ON[/TD]
[TD]150[/TD]
[TD]$40,000[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]
I'm trying to create a rank query from access to rank the lowest cost as shown below. Below are all the fields in my table and I am ranking them based on ORG STATE and DEST PROV. The example below is two transportation carriers going to two different origin/destination (CA to AB and CA to ON). I need to rank the lowest cost based on these pairings. I would appreciate if someone can provide me the sql query for this. Thanks in advance
[TABLE="width: 620"]
<colgroup><col><col><col><col><col><col></colgroup><tbody>[TR]
[TD]Carrier Name [/TD]
[TD]ORG STATE[/TD]
[TD]DEST PROV[/TD]
[TD]# of shipments[/TD]
[TD]Total Cost[/TD]
[TD]Rank[/TD]
[/TR]
[TR]
[TD]Carrier A[/TD]
[TD]CA[/TD]
[TD]AB[/TD]
[TD]293[/TD]
[TD]$50,000[/TD]
[TD="align: right"]1[/TD]
[/TR]
[TR]
[TD]Carrier B[/TD]
[TD]CA[/TD]
[TD]AB[/TD]
[TD]293[/TD]
[TD]$75,000[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Carrier A[/TD]
[TD]CA[/TD]
[TD]ON[/TD]
[TD]150[/TD]
[TD]$42,000[/TD]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD]Carrier B[/TD]
[TD]CA[/TD]
[TD]ON[/TD]
[TD]150[/TD]
[TD]$40,000[/TD]
[TD="align: right"]1[/TD]
[/TR]
</tbody>[/TABLE]