Billy Jow here!
In my historical table I have a status field that can take four possible values:
'EVALUATE', 'FAIL', 'REVOK', 'SUCCESS'
I want to select 20 records of each status where the date is most recent.
Since I want only th...
Is it wrong to do this on a bank table?
I'll cite an example:
We have the Client: Google
And in it we have the unit: Google Brazil
Then we have the following table example:
Client Table
Id | Nome | Matriz
1 | Google...
I have the following query :
SELECT
s1.suprimento,
e1.numeroserie,
s1.capacidade,
e1.numeronotafiscal,
e1.valorunitario,
e1.datanotafiscal
FROM
public.estoque e1,
public.suprimento s1,
public.fornec...
I have a table with 5 fields:
id
name
charge
salary
data
... and I wanted to make a query that would return the names of the people with the highest salary, of each position, for example I have 3 positions: analyst, dev and engine...
I'm currently developing a program to help manage a barracks in my city, I'm using Qt to create the graphical interface and other necessary libraries like database manipulation, for the server I'm using postgres , when trying to cre...
I'm doing a function in PostgreSQL and I want to use it to check whether a table already exists or not in a database, and if it does not exist, I want to create the table.
The problem is in the function statement, which receives varchar...
This query gives me the total attendance of two parliamentary groups (eg PS, PSD) between two dates:
SELECT DISTINCT a.partido,
(SELECT COUNT(presencas.assiduidade) FROM presencas, reunioes
WHERE presencas.assiduidade = 'Presença (P)'
A...
I need to create a query that returns all active students and their grades for each subject. If the student does not have a grade for a given subject, the student must return the subject and note the value "No grade".
I think I'll need to cre...
Well, this is what I'm doing, I'm having to do a select in a database, where I should look for values that exist between two dates, and that have a specific user. I made the select like this:
SELECT * FROM 'tabela' WHERE 'data' BETWEEN 'dataIn...
I need to get parameters for a view , but since it has COUNT(DISTINCT DTA_HOR) I can not get the where external. Would it have any other way?
SELECT EX1 ,EX2, EX3, EX4,
(SELECT COUNT(DISTINCT DTA_HOR) FROM TB_1
WH...