0
votes
0answers
10 views

Bulk Insert from Select PostgreSQL

Fastest way to do insert in a table Aexample with same structure of a table Bexample: INSERT INTO Aexample SELECT * FROM Bexample I can't rename table because in table Aexample there are indexes ...
0
votes
0answers
8 views

CakePHP SELECT CASE WHEN - Not Working

I've tried to follow the instructions in these pages: https://groups.google.com/forum/?fromgroups#!topic/cake-php/rUXgKrCbKMo Cakephp CASE WHEN argument in find conditions In order to get my query, ...
1
vote
2answers
17 views

Postgres update with previous row

I have a table that records values from electrical meters The table looks like this SELECT created_at, value, delta FROM metervalues ORDER BY created_at 2013-05-28 07:59:00 | 752105,6 | null ...
2
votes
1answer
16 views

Array aggregation for all columns in a table in Postgres

WITH Dept(DName, HeadCount) AS ( VALUES ('D1', 5), ('D2', 6), ('D3', 7) ) Select array_agg(DName), array_agg(HeadCount) from Dept The above query will yield. "{D1,D2,D3}";"{5,6,7}" Is there ...
0
votes
1answer
10 views

getResultList() generate org.hibernate.TransientObjectException: object references an unsaved transient instance

I'm aware that this problem has been asked several times before. But I believe I have a very different case, I'm currently encountering this error when invoking the getResultList() method, not when ...
1
vote
3answers
33 views

Postgres selecting only columns that meet a condition

If I have a database table t1 that has the following data: How can I select just those columns that contain the term "false" a | b | c | d ------+-------+------+------ 1 | 2 | ...
0
votes
2answers
20 views

Postgresql Multiple counts for one table

From two columns in my table I want to get a unified count for the values in these columns. As an example, two columns are: Table: reports | type | place | ...
1
vote
3answers
40 views

Database Design with Change History

I am looking to design a database that keeps track of every set of changes so that I can refer back to them in the future. So for example: Database A +==========+========+==========+ | ID | ...
0
votes
1answer
21 views

Postgres: Get the Complement of Distinct Entries

Currently I can get distinct entries from a table like this: SELECT DISTINCT ON (abc.entry) abc.* FROM table abc JOIN table1 def ON abc.entry = def.entry WHERE def.created >= 'some_date' AND ...
0
votes
4answers
60 views

SQL ORDER BY LIKE

This is similar to my previous question located here.Is there any way in SQL (using ActiveRecord) that you can order a relation using the LIKE operator? For instance, I'm querying a relation where one ...
0
votes
2answers
24 views

Mulitple Tables vs Tables Indexes in Postgres

I'm a front end developer with little SQL experience. I am considering developing a data query system for an organization I work for. Currently much of the data is in a series of spreadsheets. I ...
1
vote
1answer
26 views

Find use of HTML tags and attributes in SQL database

I am writing some anti-XSS code and would like to whitelist common HTML tags and their corresponding attributes. I have a large database of customer entered HTML in a PostgresSQL database and would ...
1
vote
1answer
18 views

Match String to Array of Strings in Postgres Database Column

I have a Django app which uses a Postgres database. I am creating a temp table by doing the following: cursor.execute("""CREATE TEMP TABLE temp_table (pub_id INTEGER, pub_title TEXT, pub_tags ...
0
votes
1answer
40 views

Unexpected IF ( in END IF ) in if statement

I have read the PostgreSQL control structure page and I decided to make a test: IF 1 = 0 THEN INSERT INTO my_table (num_a, num_b) VALUES (1, 1); END IF; I have tested the insert statement ...
0
votes
3answers
45 views

fetching monthwise data from a database with a year's record in postgres

I am having a table with a years data with the following columns: Table "myData" (( "Status" character varying, "Project" character varying, "Product" character varying, ...

1 2 3 4 5 308
15 30 50 per page