I have been trying to get this to work for a while now. I have 3 tables. First table has the Sales for customers which include the CustomerID, DateOfSales (Which always has the first of the month). …
Tag: sql
Get encrypted column name with their encryption key and certificate in sql server
I am using SQL Server 2008/2012.In my database I have a table which has encrypted column. The column is encrypted by using following query – Create the example table CREATE TABLE [HR].[Employees]( …
List all foreign keys PostgreSQL
I need a query that returns: “table_name”, “field_name”, “field_type”, “contraint_name” until now i have: Answer A foreign key may be based on multiple columns, so conkey and confkey of pg_constraint are arrays. You have to unnest the arrays to get a list of col…
Copy DAO recordset from Excel into Access table
I have searched endlessly for a solution to this but can’t figure it out at all. Any help would be massively appreciated. I currently have some Access VBA code which sets up a DAO recordset connection with a range in an excel worksheet. (I have avoided linking the spreadsheet as a linked table as I am u…
Postgres Left Join with where condition
I need to left join two tables with a where condition: time_table record_table I need to get all those records which are present under given date range. In the above example, I need those records that lie under range for rid = 2 only. Hence the output for the above query needs to be: Answer left join two tabl…
Select from 2 tables with conditions
I need a SQL query, for multiple condition select from 2 tables. I want to get all rows so that I get all order_row rows from table2 which are not present in table1 and order_row rows from table2 whose timestamp is newer in table2 than table1. And checks only rows from table 2 where timestamp is newer than 20…
ADODB Connection to two access database
Due to ms access 2GB limitations on space; i am considering splitting a database into two. However I regularly rely on SQL statements such as the following: Is there a way in ADODB to perform the above, ie INSERT INTO table in file 1, the SELECT data from a table in file 2 ? Answer Here’s an example of …
Data type changing after multiplying two columns in MS Access
I want to multiply two columns with each other and use the following code CDbl(amount) * CDbl(weighting) AS [amount_weighted], “Amount” is a regular number while “weighting” is a value between 0 and …
How do I get a space in my property name?
I have the following query: The problem is that I make the property ProjeAdı in the Select clause. I want the property to match the sql column, Proje Adı (note the space). How can I do that? Answer aliases cant have spaces between them , just like any variable name cant have white space, they are considered a…
Propel adds CROSS JOIN to query when using an alias to JOIN tables
Trying to do a fairly simple query in Propel 2. I have a Person table and a Possession table – persons can have many possessions but only one of each possession type. So a person can have 1 book, 1 car, etc. I’m trying to write a query in Propel that will return all persons along with their car na…