I want to delete all duplicate entries in my MySQL database. I found a lot of solutions in the web but in every case the query worked only when you are looking up for 1 column. In my case I need a query for more than 1 row which will be executed as far as possible – the table is
How to convert PostgreSQL 9.4’s jsonb type to float
I’m trying the following query: SELECT (json_data->’position’->’lat’) + 1.0 AS lat FROM updates LIMIT 5; (The +1.0 is just there to force conversion to float. My actual queries are far more …
Filtering existing objects with SQL query
I’m looking for a library that could filter javascript collections of objets from a SQL query. No such results on Google :/ For example, this objects collection… filtered with… would return… Do you know if such a library already exists ? Or should I devellop it by myself… ? (Uhh …
Execute native sql with hibernate
I’m using hibernate 4.2.6 and PostgreSQL 9.1 I’ve been trying to execute sql query with hibernate. I’ve written: Session session = Hibernate.util.HibernateUtil.getSessionFactory().openSession(); …
Case Statement with different data type
I am trying to return SLA days for particular conditions. However for a specific condition I want it to return a different data type. Current code is as follows: SELECT CASE WHEN …
Summing up the rows
I want to add up the profit of all the rows where 1.a=2.a && 1.b=2.b && 1.c=2.c ( The case in first and second row , also in third and fourth ). I wrote the following query but this isn’t working . db.Execute “UPDATE a,b,c,SUM(profit) FROM Sum ORDER BY a” Query execution give…
Get count of foreign key from multiple tables
I have 3 tables, with Table B & C referencing Table A via Foreign Key. I want to write a query in PostgreSQL to get all ids from A and also their total occurrences from B & C. Output desired (just the id from A & total count in B & C) : SQL so far SQL Fiddle : The
mysql update column then select updated value
I have a table like this tbl_user first i want to update a row based on id now i want to get updated value of amount column i have applied this sql my question is can i combine both of above sql or any single query to achieve above task? Answer The best you could imitate is to use two
Streaming MySql ResultSet with fixed number of results at a time
I have MySql table with 16 millions records, because of some migration work I’m reading whole Mysql table. The following code is used for streaming large ResultSet in MySql statement = …
Laravel Eloquent to join table and count related
How do I use join with Eloquent taking in consideration the following table structure: I have a properies table ——————— ID | Name ——————— 1 | Property Name than …