What is wrong with my sql query of odata?
I am trying to get the number of users for each age. What is wrong with this sql query for odata.stackoverflow.com? select age, count(*) from users order by age group by age ...
I am trying to get the number of users for each age. What is wrong with this sql query for odata.stackoverflow.com? select age, count(*) from users order by age group by age ...
I have a table of contacts which has name and default_name columns among others. Contact name is name, unless name=NULL and then it is default_name (which cannot be NULL). I would like to order my selection by contact name. For example: contact_id name default_name ---------- ---- ------------ ...
I have a field that contains usernames in a mysql db eg: johndoe2 johndoe10 johndoe3 If i order by that field DESC I get: johndoe3 johndoe2 johndoe10 I need to get: johndoe10 johndoe3 johndoe2 Any help appreciated ...
Hi all, I'm working on displaying a page of classifieds in table rows. The problem I'm trying to solve is to arrange the ads in such a way that reduces the amount of white-space on the page, while maintaining a random order. A diagram of what a couple of unordered ads look like: _______________ __________________ ad text here. | an...
Is there a simpler/cleaner way to do this using SQL Server 2000? Every few days I need to do this. I first look at how many records we have total: SELECT COUNT(*) FROM MyTable Then I list all the lengths of a certain field: SELECT LEN(MyText) FROM MyTable ORDER BY LEN(MyText) ASC I then need to scroll down 1/3rd of the way... and...
the question: there are two tables - DAYS(name), ACTIONS(day_name,name) records for DAYS are: Sunday, Monday, Wednesday records for ACTIONS are: {eat,sunday}, {sleep,sunday}, {write,sunday}, {drink,sunday} {eat,wednesday}, {sleep,wednesday}, {write,wednesday}, {eat,monday}, {sleep,monday}, i want to search in ACTIONS for the day...
Hi, I have a few tables, Listings, ListingImages and a few others related to Listings. ListingImages is related to Listings so that you can have many ListingImages per Listing. When I query this table I do; IQueryable<Listing> ListingToSendToView = (from x in DBEntities.ListingSet.Include("ListingImages") ...
Hello, I need to use the MySQL Order By function in a query except I need it to be in reverse order by number - therefore like 45, 32, 12, 10 instead of 10, 12, 32, 45. I would then limit it to 1 so I would get the highest number in the list. However if you have another way to do this that would be great thanks :D Anyway thanks for you...
Do Fields after "ORDER BY" or "WHERE" might have index (PRIMARY, UNIQUE, INDEX) in mysql? Consider a table with the following columns: ID | AddedDate | CatID | Title | Description | Status | Editor In these queries, are ID, AddedDate and CatID might have index? SELECT * FROM table WHERE ID = $id SELECT * FROM table ...
Hi, I am using NHibernate 3 Alpha 2, and I am trying to do the number of posts per month This is the code I came up with List<PostMonthFrequency> monthFrequencies = _postRepository .FindAll() //.ToList() //<- if included works. however not desired .OrderByDescending(x => x.PublishedOn) .GroupBy(x => new {x.PublishedOn....
I have a table holding entries which can be sorted by rank. I want to get the top 10 entries (which is simple using SELECT * FROM table ORDER BY rank DESC), but then I want those entries in descending order, so the one with the lowest rank ends up at the top. How would I do this? ...
Hello! I have a table that I select data from with a column called parent that's of unsigned integer type. It has numbers from 0 to 12. I want to select * from table order by parent asc, but with one exception: place the 0 at the end of the select so it would be like 1,2,3,4,5,6,7,8,9,0. Is this possible with a single select in MySQL...
I'm trying to write a JPQL Query with an ORDER BY clause: query = "SELECT c FROM item ORDER BY c.name ASC" I would like to set an "order" parameter, whose value would be either "ASC" or "DESC": query = "SELECT c FROM item ORDER BY c.name :order" And then in my implementation: query.setParameter("order", "ASC"); This is when I ge...
I have a page that show "special offers", and i need to order the results by discount value. Besides i want that products with quantity=0 are shown at the end of the list (regardless of the discount value). So, there is any way to do that using only SQL? I mean... if i set "ORDER BY discount, quantity DESC" the list show products ordere...
Hi I am using the following mysql query for grouping referrersource. SELECT referrersource,count(referrersource) as counts FROM request_events where referrersource!='' AND landingpage_collectionid=1 group by referrersource Here, I would like to order by my resultset in ascending order.How can I alter my above query.Any suggectio...
Hello everyone, I tried to optimize a MySQL query which sort multiple varchar columns: SELECT * FROM tickets LEFT OUTER JOIN customers ON customers.id = tickets.customer_id LEFT OUTER JOIN locations ON locations.id = tickets.location_id ORDER BY customers.name, locations.name; The ORDER BY statement seems to cost lot of time(~100ms) ...
I have a stored proc select statement that lookes like that: SELECT p.ID AS ID, p.Title AS Title, p.Text AS Text, p.CategoryID AS CategoryID, p.PostDate AS PostDate, p.Author AS Author, p.AuthorID AS AuthorID, p.IsApproved AS IsApproved, p.Rating AS Rating, p.RatesCount AS RatesCount, t.Text A...
maybe foolish question, first times with linq to entities (well, linq in general). table with id(int), value(decimal), name(string) for each record i need id list<string> id value name THE FOLLOWING WORKS FINE int pageSize=10 int pageIndex=2 var data = (from c in db.Customers orderby c.ID selec...
Welcome, I'm wondering is it possible to reverse returned data in sorting "order by desc" but i want that data in reverse order. For example, i got table with values ID 1 2 3 4 And i do Order by ID ASC LIMIT 3 I got 1 2 3 When i do Order by ID DESC limit 3 i get 4 3 2 I would like to have 3 2 1 So i would like to order by...
MySQL (table) id | url | lat | lng ---------------------------------- 1 | x | 44.339565 | -101.337891 ---------------------------------- 2 | y | 44.150681 | -101.074219 ---------------------------------- 3 | z | 43.897892 | -100.634766 what I want to do now is order the list according to their proximity to (43.834527...