Click here to Skip to main content
15,908,842 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL Linq, IQueryable, ToList, just get 1 result Pin
jkirkerx4-Dec-15 7:04
professionaljkirkerx4-Dec-15 7:04 
QuestionReport View Error Pin
Member 121385253-Dec-15 1:55
Member 121385253-Dec-15 1:55 
QuestionRe: Report View Error Pin
Richard MacCutchan3-Dec-15 2:10
mveRichard MacCutchan3-Dec-15 2:10 
Questionhandle transaction without deadlock Pin
Member 106619971-Dec-15 5:03
Member 106619971-Dec-15 5:03 
AnswerRe: handle transaction without deadlock Pin
Afzaal Ahmad Zeeshan1-Dec-15 5:20
professionalAfzaal Ahmad Zeeshan1-Dec-15 5:20 
GeneralRe: handle transaction without deadlock Pin
Richard Deeming1-Dec-15 5:37
mveRichard Deeming1-Dec-15 5:37 
QuestionHELP ME ADD EXCEPTION Pin
VicPat25-Nov-15 2:14
VicPat25-Nov-15 2:14 
AnswerRe: HELP ME ADD EXCEPTION Pin
Mycroft Holmes25-Nov-15 12:04
professionalMycroft Holmes25-Nov-15 12:04 
QuestionRemove Unique constraint from an Non-Clustered Index Pin
indian14324-Nov-15 6:26
indian14324-Nov-15 6:26 
QuestionStudent Grade and Grade Point Callculation Pin
Aliyu Usman21-Nov-15 11:50
Aliyu Usman21-Nov-15 11:50 
AnswerRe: Student Grade and Grade Point Callculation Pin
Mycroft Holmes21-Nov-15 13:41
professionalMycroft Holmes21-Nov-15 13:41 
GeneralRe: Student Grade and Grade Point Callculation Pin
Aliyu Usman21-Nov-15 19:07
Aliyu Usman21-Nov-15 19:07 
GeneralRe: Student Grade and Grade Point Callculation Pin
Mycroft Holmes21-Nov-15 20:47
professionalMycroft Holmes21-Nov-15 20:47 
AnswerRe: Student Grade and Grade Point Callculation Pin
GuyThiebaut24-Nov-15 2:08
professionalGuyThiebaut24-Nov-15 2:08 
Questionnewtonsoft.json parser - how to deploy a CLR to SQL Server 2008 R2? Pin
Member 822518018-Nov-15 11:55
Member 822518018-Nov-15 11:55 
QuestionRemoval and delete of duplicate records in my table Pin
goldsoft15-Nov-15 2:37
goldsoft15-Nov-15 2:37 
AnswerRe: Removal and delete of duplicate records in my table Pin
Mycroft Holmes15-Nov-15 11:53
professionalMycroft Holmes15-Nov-15 11:53 
AnswerRe: Removal and delete of duplicate records in my table Pin
RNA Team15-Nov-15 16:00
RNA Team15-Nov-15 16:00 
QuestionI need to get a count of records, including column Names grouped by UnitName. What am I doing wrong? Pin
samflex13-Nov-15 5:34
samflex13-Nov-15 5:34 
AnswerRe: I need to get a count of records, including column Names grouped by UnitName. What am I doing wrong? Pin
Mycroft Holmes13-Nov-15 13:56
professionalMycroft Holmes13-Nov-15 13:56 
AnswerRe: I need to get a count of records, including column Names grouped by UnitName. What am I doing wrong? Pin
RNA Team13-Nov-15 16:32
RNA Team13-Nov-15 16:32 
QuestionSQL Linq, better idea than a join for as enumerable Pin
jkirkerx11-Nov-15 9:09
professionaljkirkerx11-Nov-15 9:09 
So I have this SQL Linq statement, pretty easy until I added Free Shipping.
In the original statement, I get the data from ORDER_COMPLETED and do a join to SHIPPING_REALTIME in which I grab the Realtime rate name.

But Now, I added Free Shipping, by using another table that holds my criteria. So now I have 2 tables to get the rate name from, the other called SHIPPING_FREEMATRIX

I'm trying to think of a better more proper way to do this.

So what I have so far is
pResults = _
(
   From oc In context.Order_Completed
   Join srt In context.Shipping_Realtime On srt.RateAPICode Equals oc.RateAPICode // My Join
   Where oc.OrderStatus = "QUEUED_FOR_FULFILLMENT" _
   Or oc.OrderStatus = "OUT_FOR_FULFILLMENT" _
   Or oc.OrderStatus = "ORDER_CANCELED" _
   And oc.OrderDate >= DbFunctions.AddDays(Today, -7)
   Order By oc.OrderNumber
   Select New coOrderIndex With
  {
     .OrderID = oc.CompletedOrderID,
     .OrderDate = oc.OrderDate,
     .OrderNumber = oc.OrderNumber,
     .OrderStatus = oc.OrderStatus,
     .LoginID = oc.LoginID,
     .GrandTotal = oc.GrandTotal,
     .RateAPICode = oc.RateAPICode,
     .RateCharge = oc.TotalNetCharge,
     .RateAPIName = If(srt.RateName Is Nothing, "", srt.RateName) // This is the rate name
  }
).AsEnumerable()
pValue = pResults.Count()
I tried using a tenary operator on RateName, but got an error saying First or Single can only be used at the end of the statement.
.RateAPIName = If(//Context.Any, //Single Linq Statement, //Single Linq Statement)
I tried a function but got the error can't execute an external function within a store statement
.RateAPIName = get_rateAPIName(oc.RateAPICode)
I tried a double join but got nothing
Join srt In context.Shipping_Realtime On srt.RateAPICode Equals oc.RateAPICode
Join fsm In context.Shipping_FreeMatrix On fsm.RateAPICode Equals oc.RateAPICode
I thought about taking the pResults and just looping back through using for each and populating the RateAPI Name, but I tried the above methods instead and aborted this thought.
for each pResult as coOrderIndex in pResults
  pResult.RateAPIName = // Another statement
next

If it was a single record that was easy for me, but doing it with multiple records is, well I'm not sure how to proceed.
AnswerRe: SQL Linq, better idea than a join for as enumerable Pin
Jörgen Andersson11-Nov-15 9:53
professionalJörgen Andersson11-Nov-15 9:53 
GeneralRe: SQL Linq, better idea than a join for as enumerable Pin
jkirkerx12-Nov-15 7:55
professionaljkirkerx12-Nov-15 7:55 
GeneralRe: SQL Linq, better idea than a join for as enumerable Pin
Jörgen Andersson12-Nov-15 9:13
professionalJörgen Andersson12-Nov-15 9:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.