Category "sql"

Warning: sqlite_query() expects parameter 1 to be resource, string given

I've looked all over the place and cant find a solution that helps my case. I hope someone can help? I have this and receive Warning: sqlite_query() expects pa

Using VBA to query a SQL Server table in Excel

I'm trying to query a table in Microsoft Excel using VBA. I've written up some code to try and accomplish this task, but I keep getting an error: run-time e

Update table values from another table with the same user name

I have two tables, with a same column named user_name, saying table_a, table_b. I want to, copy from table_b, column_b_1, column_b2, to table_b1, column_a_1, c

recursive tree as a list (array items) in a new attribute value child

How to get hierarchy data(recursive tree) as a new column like below? (if there is last child then column child array is empty) rows: [{ 'id' : 1, 'paren

Update button in datagrid, entity framework WPF Application

I'm attempting to create an update button, that you can press to automatically update a record within a DB. the update button opens a new dialog, which then all

Mapping columns in a DataTable to a SQL table with SqlBulkCopy

I would like to know how I can map columns in a database table to the datatable in c# before adding the data to the database. using (SqlBulkCopy s = new SqlBul

How to return NULL when result is empty?

I have a simple query that selects one field and only one row, thus one value. Is there any way to make it return NULL if the query results in an empty set? In

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

MySQL Query error using UNION/UNION ALL and Group By

Generate the following two result sets: 1). Query an alphabetically ordered list of all names in OCCUPATIONS, immediately followed by the first letter of each

Find the number of employees in each department - SQL Oracle

I have two tables Emp and Dept and I am trying to display how many people work in each department along with their department name, but I can't get it to work.

SQLite3.exe shell not successfully creating database?

I am trying to create a sqlite3 database on my windows 7 64 bit machine. I have downloaded sqlite-shell-win32-x86-3071700.zip from http://www.sqlite.org/downloa

SELECT inside a COUNT

I would like to embed a SELECT inside a COUNT, but I can't find any examples. #pseudosql SELECT a AS current_a, COUNT(*) AS b, COUNT( SELECT FROM t WHERE a

QueryDsl BooleanBuilder: How to create a predicate that compares another field?

I have simple example: to find all items that are sold out. Item has initialQuantity and soldQuantity integer fields. (for some reason I need initialQuantity

Sql Server query varchar data sort like int

I have one table like CREATE TABLE table_name ( P_Id int, amount varchar(50) ) Data Like Id amount ---------- 1 2340 2 4568 3 10000 Now I want to sort t

Replace last two characters in column

I have a column with dates in the format 201201, 201202, 201203 etc. This is a financial database so there is a period 13; however periods 12 & 13 are comb

Query to get only numbers from a string

I have data like this: string 1: 003Preliminary Examination Plan string 2: Coordination005 string 3: Balance1000sheet The output I expect is string 1:

MySQL - How do I enter NULL?

In SQL, I know I can do: UPDATE TableA SET MyColumn=NULL But, how do I enter NULL into a cell graphically? I tried entering 'null' and 'NULL' and '' (nothing/e

MySQL - How do I enter NULL?

In SQL, I know I can do: UPDATE TableA SET MyColumn=NULL But, how do I enter NULL into a cell graphically? I tried entering 'null' and 'NULL' and '' (nothing/e

MySQL - How do I enter NULL?

In SQL, I know I can do: UPDATE TableA SET MyColumn=NULL But, how do I enter NULL into a cell graphically? I tried entering 'null' and 'NULL' and '' (nothing/e

Getting maximum value of float in SQL programmatically

Is there an method for programmatically (in T-SQL) retrieving the maximum (and minimum) value of a datatype? That it would act like float.MaxValue in C#. I wou