Click here to Skip to main content
15,911,646 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL boolean comparison Pin
User 1106097926-Jul-17 22:42
User 1106097926-Jul-17 22:42 
AnswerRe: SQL boolean comparison Pin
Richard Deeming27-Jul-17 1:41
mveRichard Deeming27-Jul-17 1:41 
GeneralRe: SQL boolean comparison Pin
User 1106097927-Jul-17 1:53
User 1106097927-Jul-17 1:53 
GeneralRe: SQL boolean comparison Pin
User 1106097927-Jul-17 22:41
User 1106097927-Jul-17 22:41 
QuestionSQL Linq, getting 3 of each record. Pin
jkirkerx24-Jul-17 10:16
professionaljkirkerx24-Jul-17 10:16 
AnswerRe: SQL Linq, getting 3 of each record, [WAIT] Pin
jkirkerx24-Jul-17 10:29
professionaljkirkerx24-Jul-17 10:29 
JokeRe: SQL Linq, getting 3 of each record, [WAIT] Pin
Afzaal Ahmad Zeeshan24-Jul-17 10:40
professionalAfzaal Ahmad Zeeshan24-Jul-17 10:40 
AnswerRe: SQL Linq, getting 3 of each record. Pin
Afzaal Ahmad Zeeshan24-Jul-17 10:36
professionalAfzaal Ahmad Zeeshan24-Jul-17 10:36 
I am surprised as to why you didn't consider using GroupBy function? That would be useful in grouping the objects by a property, so that only distinct ones are returned, since they will be grouped by their property in a similar manner, to what you want to expect from Distinct function call here. Something like this,
C#
// Since you said C#
from oh in context.Order_History
where oh.OrderDate ...

orderby oh.OrderNumber desc
group oh by oh.RequiredProperty in ohGrouped // RequireProperty is the property you want to use

... 
select ...
Something like this will be useful, as it will group the records by the properties which you specify. Please have a look here, [c# - Group by in LINQ - Stack Overflow](https://stackoverflow.com/questions/7325278/group-by-in-linq)

There is a library, which contains a lot of added features to LINQ, you should also look into it as it might also help you out with a lot of good function calls, such as this DistinctBy (DistinctBy takes the properties by which you want to select the records), get it here, GitHub - morelinq/MoreLINQ: Extensions to LINQ to Objects
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~

QuestionIF then ? Pin
patsq19-Jul-17 12:00
patsq19-Jul-17 12:00 
AnswerRe: IF then ? Pin
PIEBALDconsult19-Jul-17 13:01
mvePIEBALDconsult19-Jul-17 13:01 
QuestionRe: IF then ? Pin
Richard MacCutchan19-Jul-17 21:51
mveRichard MacCutchan19-Jul-17 21:51 
AnswerRe: IF then ? Pin
patsq20-Jul-17 2:23
patsq20-Jul-17 2:23 
AnswerRe: IF then ? Pin
Richard Deeming20-Jul-17 1:36
mveRichard Deeming20-Jul-17 1:36 
GeneralRe: IF then ? Pin
Chris Quinn20-Jul-17 5:59
Chris Quinn20-Jul-17 5:59 
GeneralRe: IF then ? Pin
Richard Deeming20-Jul-17 6:50
mveRichard Deeming20-Jul-17 6:50 
GeneralRe: IF then ? Pin
Chris Quinn20-Jul-17 21:22
Chris Quinn20-Jul-17 21:22 
GeneralRe: IF then ? Pin
Richard Deeming21-Jul-17 0:15
mveRichard Deeming21-Jul-17 0:15 
AnswerRe: IF then ? Pin
Pradeep Magati11-Aug-17 2:58
Pradeep Magati11-Aug-17 2:58 
QuestionSetting values from a Pivot to 0? Pin
patsq18-Jul-17 4:55
patsq18-Jul-17 4:55 
AnswerRe: Setting values from a Pivot to 0? Pin
Chris Quinn18-Jul-17 5:01
Chris Quinn18-Jul-17 5:01 
GeneralRe: Setting values from a Pivot to 0? Pin
patsq18-Jul-17 5:08
patsq18-Jul-17 5:08 
GeneralRe: Setting values from a Pivot to 0? Pin
patsq18-Jul-17 5:24
patsq18-Jul-17 5:24 
QuestionPruning unused tables in a live database. Pin
mbb0113-Jul-17 2:43
mbb0113-Jul-17 2:43 
AnswerRe: Pruning unused tables in a live database. Pin
Mycroft Holmes13-Jul-17 13:31
professionalMycroft Holmes13-Jul-17 13:31 
AnswerRe: Pruning unused tables in a live database. Pin
Chris Quinn14-Jul-17 0:09
Chris Quinn14-Jul-17 0:09 

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.