Tagged Questions
1
vote
0answers
15 views
Rails: A database-independent datatype that's suitable for bitwise operations
I have a Rails app with a couple resources that I need to run queries on the involve bitwise operations. Right now, I'm using PostgreSQL, and I created a migration for my 'user' model that uses the ...
0
votes
0answers
18 views
Trigger procedure in PostgreSQL
I'm trying to implement a trigger procedure and I'm kind of stuck. I have a table product and a table productPhotos. Here's the structure of productPhotos:
CREATE TABLE dim_product_photo
(
photo_id ...
1
vote
1answer
24 views
Using INTERSECT with tables from a WITH clause
What is wrong with this query:
WITH volcan AS (SELECT DISTINCT v.numturista
FROM viaje v, sitio s
WHERE v.numsitio = s.numsitio
AND s.tipo = 'Volcan'),
...
0
votes
0answers
8 views
st_within for entire table
Most st_within methods I see are comparing one point
I want to be able to tell if my coordinates are within many points, an entire table's worth, because I
basically like
select attributeA, ...
2
votes
2answers
23 views
Check for complete duplicate rows in a large table
My original question with all the relevant context can be found here:
Adding a multi-column primary key to a table with 40 million records
I have a table with 40 million rows and no primary key. ...
2
votes
1answer
14 views
SQL Query: Group Time into timeslices then group by loginname then count distinct loginnames per timeslice
I have a huge table containing starting times of the operation (starttime) + the user who started it (loginname) + a lot of date which is uninportant for the query i need.
From that i want to group ...
0
votes
0answers
36 views
Multiple nested update/insert statement in postgres
I have the problem, that I have to do an insert into on table of my database and a update another table with the id, the insert provided me with.
I tried this:
UPDATE events SET mail_key = (
INSERT ...
0
votes
0answers
32 views
Bulk insert between tables in same database
Fastest way to do insert in a table A with same structure of a table B:
INSERT INTO A
SELECT * FROM B
I can't rename table because in table A there are indexes that when query is executed it's ...
-1
votes
0answers
12 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
26 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
24 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
11 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
41 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 | ...