firebird1.5

Obtaining one value per person from table (“latest-n-per-group before cutoff date”)

泪湿孤枕 提交于 2021-01-28 12:32:49
问题 In a database of mine there is a table called 'Budget' defined as follows CREATE TABLE BUDGET ( ID INTEGER NOT NULL, THERAPIST INTEGER, CURDATE DATE, ILLNESS SMALLINT, HOLIDAY SMALLINT); ALTER TABLE BUDGET ADD PRIMARY KEY (ID); The purpose of the table is to store how many hours a month a therapist is entitled to sick leave and regular holiday. The table has the following values ID: 1, THERAPIST: 36, CURDATE: 01/01/2012, ILLNESS:8, HOLIDAY: 8 ID: 2, THERAPIST: 36, CURDATE: 01/07/2012, ILLNESS

Obtaining one value per person from table (“latest-n-per-group before cutoff date”)

微笑、不失礼 提交于 2021-01-28 12:32:04
问题 In a database of mine there is a table called 'Budget' defined as follows CREATE TABLE BUDGET ( ID INTEGER NOT NULL, THERAPIST INTEGER, CURDATE DATE, ILLNESS SMALLINT, HOLIDAY SMALLINT); ALTER TABLE BUDGET ADD PRIMARY KEY (ID); The purpose of the table is to store how many hours a month a therapist is entitled to sick leave and regular holiday. The table has the following values ID: 1, THERAPIST: 36, CURDATE: 01/01/2012, ILLNESS:8, HOLIDAY: 8 ID: 2, THERAPIST: 36, CURDATE: 01/07/2012, ILLNESS

Field name from ID on table 1 but name on other table

让人想犯罪 __ 提交于 2019-12-10 21:00:06
问题 This is a Firebird database. First Table Contacts Company_ID - job_title Second Table Client_id - Co_name In contacts, I want to the job_title field to contain the co_name. client_id and company_id are the same. Co_name correspond to company_id as well as client_id. this: UPDATE Contacts SET Contacts.Job_title = Clients.co_name where company_id in ( select client_id from clients JOIN Contacts c ON Client_id=company_id where record_status='A') gives me an error as cannot find (clients.co_name)

Updating generator value issue

99封情书 提交于 2019-12-10 14:51:53
问题 I'm currently working on modifying a Firebird v. 1.5 database. The database structure will be modified running queries from a delphi application using interbase components, the problem I'm facing is that I need to run a lot of queries, some of which include creating generators and updating the generator value, the problem is that I need to achieve this in as few queries as possible, but it seems(at least to me) that this is not really possible, what I'm trying to do is the following: /* this