sql-order-by

LINQ : Distinct and Orderby

扶醉桌前 提交于 2020-11-28 04:43:28
问题 I am trying to use LINQ (to EF) to get a DISTINCT list and then sort it. All the examples I found sort the result based on the DISTINCT value. But I want to sort it on a different field. Example: Table with 2 fields (canvasSize and canvasLength); var sizes = (from s in ent.competitors select s.canvasSize).Distinct().OrderBy(x => x); All the examples I found give this type of answer. But it sorts by canvasSize whereas, I want to sort by canvasLength. I'm stuck ... Any tips are greatly

Nested comment system mysql ordering

可紊 提交于 2020-08-11 01:47:05
问题 Ok, I realize there are many ways to accomplish comments. The way I have chosen is a single table set up like this. id comment date time orig_comment 1 Hello 03-01-2013 10:10:10 0 2 Hello 03-02-2013 10:10:10 0 3 Hello 03-03-2013 10:10:10 1 So to clearify there is a first level and then users can reply to that comment(these are the only two levels). I give each unique incrementing id, and specify orig_comment. If orig_comment is "0" then it is a base level comment, if it is nested then orig

How to display elements in alphabetically order ins SQLite3

只谈情不闲聊 提交于 2020-08-09 19:30:53
问题 I want to display my records in alphabetically order using SQLite3 statement: SELECT * FROM medicine ORDER BY name ASC but.. 1) It display records like this for example: ADRENALINE BETALOC CAPTORIL …… Adrenaline Betaloc Captopril …… adrenaline betaloc captopril ….. 2) But I want that sqlite3 displays like this: ADRENALINE Adrenaline adrenaline ……… BETALOC Betaloc betaloc ……… CAPTOPRIL Captopril captopril …………. How to write it statement that it displays like In the second case I know that