All Questions

Tagged with
Filter by
Sorted by
Tagged with
185votes
9answers
688kviews

How to do INSERT into a table records extracted from another table

I'm trying to write a query that extracts and transforms data from a table and then insert those data into another table. Yes, this is a data warehousing query and I'm doing it in MS Access. So ...
user avatar
  • 20.2k
111votes
8answers
858kviews

How to SUM two fields within an SQL query

I need to get the total of two fields which are within the same row and input that number in a field at the end of that same row. This is my code. Sum(tbl1.fld1 + tbl1.fld2) AS [Total] Is this ...
user avatar
  • 1,537
95votes
6answers
301kviews

delete all from table

what's faster? DELETE FROM table_name; or DELETE FROM table_name where 1=1; why? does truncate table work in access?
user avatar
  • 52.6k
84votes
16answers
190kviews

SQL Query - Using Order By in UNION

How can one programmatically sort a union query when pulling data from two tables? For example, SELECT table1.field1 FROM table1 ORDER BY table1.field1 UNION SELECT table2.field1 FROM table2 ORDER BY ...
user avatar
82votes
4answers
173kviews

How can I convert an MDB (Access) file to MySQL (or plain SQL file)?

Is it possible to create a Dump of SQL commands from a Microsoft Access database? I hope to convert this MDB file into a MySQL database for importing so I don't have to go through the CSV step. I ...
user avatar
  • 80.6k
80votes
3answers
89kviews

SQL multiple join statement

When I had only one inner join in my SQL statement, it worked perfectly. I tried joining a second table, and now I am getting an error that says there is a syntax error (missing operator). What is ...
user avatar
  • 1,513
70votes
9answers
107kviews

How to see the real SQL query in Python cursor.execute using pyodbc and MS-Access

I use the following code in Python (with pyodbc for a MS-Access base). cursor.execute("select a from tbl where b=? and c=?", (x, y)) It's Ok but, for maintenance purposes, I need to know the ...
user avatar
  • 3,082
67votes
15answers
128kviews

How to find longest string in the table column data

I've a table contains the columns like Prefix | CR ---------------------------------------- g | ;#WR_1;#WR_2;#WR_3;#WR_4;# v | ;#WR_3;#WR_4;# j | WR_2 m ...
user avatar
  • 1,366
52votes
2answers
113kviews

Multiple INNER JOIN SQL ACCESS

Syntax Error (missing Operator) in query expression 'tbl_employee.emp_id = tbl_netpay.emp_id INNER JOIN tbl_gross ON tbl_employee.emp_id = tbl_gross.emp_ID INNER JOIN tbl_tax ON tbl_employee.emp_id - ...
user avatar
48votes
2answers
73kviews

Why is "Yes" a value of -1 in MS Access database?

I'm looking at linked data in MS Access. The "Yes/No" fields contain the value -1 for YES and 0 for NO. Can someone explain why such a counter-intuitive value is used for "Yes"? (Obviously, it should ...
user avatar
  • 2,057
47votes
12answers
53kviews

SQL: Using NULL values vs. default values

What are the pros and cons of using NULL values in SQL as opposed to default values? PS. Many similar questions has been asked on here but none answer my question.
user avatar
44votes
6answers
93kviews

Date Difference between consecutive rows

I have a table with following structure ID Account Number Date 1 1001 10/9/2011 (dd/mm/yyyy) 2 2001 1/9/2011 (dd/mm/yyyy) 3 2001 3/9/...
user avatar
40votes
14answers
61kviews

Editing Record issues in Access / SQL (Write Conflict)

a problem has come up after a SQL DB I used was migrated to a new server. Now when trying to edit a record in Access (form or table), it says: WRITE CONFLICT: This record has been changed by another ...
user avatar
39votes
3answers
208kviews

How to create a new column in a select query

In MS Access, I want to insert a new column into the returned result of a select query. The new column has the same value for every row. For example, my select returns columns A, B and I want C to be ...
user avatar
  • 20.2k
36votes
3answers
98kviews

Case expressions in Access

Can you use case expressions in Access? I'm trying to determine the max date form 2 columns but keep getting syntax errors in the following code: CASE WHEN dbo_tbl_property.LASTSERVICEDATE > ...
user avatar

15 30 50 per page
1
2 3 4 5
1004