How to do Group By in grails to order by Count(*)
How do I translate: SELECT COUNT(*) AS `count`, `a` FROM `b` GROUP BY `a` ORDER BY `a` into grails or gorm query? ...
How do I translate: SELECT COUNT(*) AS `count`, `a` FROM `b` GROUP BY `a` ORDER BY `a` into grails or gorm query? ...
I have two very large enterprise tables in an Oracle 10g database. One table keeps the historical information of the other table. The problem is, I'm getting to the point where the records are just too many that my insert update is taking too long and my session is getting killed by the governor. Here's a pseudocode of my update process...
How could I make this kind of query e.g. in MySQL SELECT * FROM Table t WHERE t.a IN (1,2,3) AND t.b IN (4,5,6) AND t.c IN (7,8,9) ... so that the result would contain only the three rows: t.a|t.b|t.c ---+---+--- 1 | 4 | 7 2 | 5 | 8 3 | 6 | 9 The above query of course returns all the combinations of the values in the IN claus...
I have Two Many-To-Many tables which I need to write a Entity Framework Linq query for. All I want to do is to retrieve any People from the "People" table who have a relation to the Company ID = 7. Can someone give me an idea of what that would look like? The tables look something like: People, ID PK, Title, Forename, Surname People...
I have managed to get paging to work, almost. I want to display to the user, total nr of records found, and the currently displayed records. Ex: 4000 found, displaying 0-100. I am testing this with the nr 2 (because I don't have that many records, have like 20). So I am using LIMIT $start, $nr_results; Do I have to make two queries i...
The database includes a table with a rows: html/css/java/php How with sql query delete "java"? The result would be: html/css/php ...
Hi, I'm trying to display all orders placed and I have a primary accessdatasource control that has a select query to get the customer information and the orderID. I want to use the orderID value from this first query as a parameter for the secondary accessdatasource control that selects the product information of the products in the ord...
I have this query: SELECT mt.*, fordon.*, boende.*, elektronik.*, business.*, hem_inredning.*, hobby.* FROM classified mt LEFT JOIN fordon ON fordon.classified_id = mt.classified_id LEFT JOIN boende ON boende.classified_id = mt.classified_id LEFT JOIN elektronik ON elektronik.classified_id = mt.classified_id LEFT JOIN business ON bu...
I've got a C# application which takes a users notes which can include various punctuation marks such as commas, apostrophes, semicolons etc. At the moment I'm getting my application to encode the strings and storing them into the database as base 64. Is there a better way? FYI: I'm using a MySQL through their ODBC driver ...
So, I have a table and I want to get the value from one field in the record with the greatest DateTime() value in another field and where still another field is equal to a certain value. Example data: Balance Created MeterNumber 7924.252 02/02/2010 10:31:48 AM 2743800 7924.243 02/02/2010 11:01:37 AM...
Let's say I had a query like this: SELECT * FROM ( SELECT 'a' AS a, '1' AS b UNION SELECT 'a' AS a, '2' AS b UNION SELECT 'b' AS a, '1' AS b) AS a GROUP BY a.a In this case "a".b is an aggregate of 1,2 while "b".b is only an aggregate of 1. How can I select only "a"? Question updated to be a bit clearer: Let's take this ve...
Here is some sample code that inserts a record into a db table: Dim ds As DataSet = New DataSet() da.Fill(ds, "Shippers") Dim RowDatos As DataRow RowDatos = ds.Tables("Shippers").NewRow RowDatos.Item("CompanyName") = "Serpost Peru" RowDatos.Item("Phone") = "(511) 555-5555" ds.Tables("Shippers").Rows.Add(RowDatos) Dim custCB As SqlComma...
I have a large number of rows that I would like to copy, but I need to change one field. I can select the rows that I want to copy: select * from Table where Event_ID = "120" Now I want to copy all those rows and create new rows while setting the Event_ID to 155. How can I accomplish this? ...
My issue is that I want to display data in a hierarchal structure as so: Democrat County Clerk Candidate 1 Candidate 2 Magistrate Candidate 1 Candidate 2 Candidate 3 But I'm retrieving the dataset like this: Party | Office | Candidate -------------------------------------------- Democrat | County Clerk | Candidate 1 Democrat |...
Hi, I have some data with start and stop date that I need to sum. I am not sure how to code for it. Here are is the data I have to use: STARTTIME, STOPTIME, EVENTCAPACITY 8/12/2009 1:15:00 PM, 8/12/2009 1:59:59 PM, 100 8/12/2009 2:00:00 PM, 8/12/2009 2:29:59 PM, 100 8/12/2009 2:30:00 PM, 8/12/2009 2:59:...
I'm using SQL server 2008. I have 2 Tables: Table 1 and Table 2. Table 1 has 1 column called: OldDate which is nvarchar(255), null Table 2 has 1 column called: NewDate which is datetime, not null Example data in Table 1: 26/07/03 NULL NULL 23/07/2003 7/26/2003 NULL 28/07/03 When i try CAST(OldDate as datetime) I get this error: ...
Hello, I've removed the primary key of one table of my MySQL database, but now, when I use the MySQL Administrator and try to edit some data of this table, it doesn't allow me to do this. The button edit that appears in the bottom of the table keeps visible, but disabled to click. ...
Can a DevExpress XtraGrid be filled using a a Dynamic SELECT statement string? i.e. SELECT * FROM Employee or SELECT * FROM Dependents To fill our XtraGrids currently, we use a ORM that creates entities. To do this it takes a lot of steps and time. What is driving me to ask this question is we do a lot of client aquistions where we ...
Is there such a thing as Design Patterns in SQL ??? ...
Which software is recommended? I know of Adobe Browser Lab only, and it seems pretty new... Is there any better SW out there? Thanks PS: I have a classifieds website (PHP, MySql, Solr, js) developed on local computer using virtual server etc... Now I need to test it on different browsers. It is developed only with Firefox, so it works...