The objective is below the list of tables.
Tables:
Table: Job
JobID
CustomerID
Value
Year
Table: Customer
CustomerID
CustName
Table: Invoice
SaleAmount
CustomerID
The Objective
Part 1: (easy) I need to select all invoice records and sort by Customer (To place nice w/ Crystal Reports)
Select * from Invoice as A inner join...
I have two tables: CATEGORY and SUBCATEGORY
Table Structure for CATEGORY
category_id int(11)
category_name varchar(250)
category_status enum('0', '1')
Table Structure for SUBCATEGORY
subcategory_id int(10)
subcategory_name varchar(255)
status enum('0', '1')
For example there is a single...
SELECT * FROM
(SELECT BAR.DIAGNOSES FROM FOO INNER JOIN BAR ON FOO.AN = BAR.AN WHERE FOO.ADMWARD IN (16,17) AND (BAR.DIAGNOSES IS NOT NULL)
UNION ALL
SELECT BAR.UNDERLYINGCAUSE FROM FOO INNER JOIN BAR ON FOO.AN = BAR.AN WHERE FOO.ADMWARD IN (16,17) AND (BAR.UNDERLYINGCAUSE IS NOT NULL)
UNION ALL
SELECT BAR.UNDERLYINGCAUSE2 FROM FOO INNE...
Hi,
I have parent / child tables:
parent table:
id | description
1 | Alexandra
2 | Natalia
child table:
id | id_parent | description
1 | 1 | Programmer
2 | 1 | Surgery
3 | 2 | Programmer
4 | 2 | IT
How to return set of record according filters, like if we want to get all records with "Programm...
How to execute this T-SQL command through a c# method so that I can get the next ID of a Table?
declare @IDColumnName as varchar(150)
declare @TableName as varchar(150)
declare @SQL as nvarchar(1000)
declare @returns as int
set @IDColumnName = 'ID'
set @TableName = 'User'
set @returns = -1
set @SQL = 'select MAX([' + @IDColumnName + '...
I am using sql.
How to select all items from a table.
where a column (varchar) path is start with a certain string : "stringABC"
select * from ATable where path like 'stringABC';
The above sql is wrong, can any one help me to fix it?
Many thanks!
...
Hi,
I'm currently building an app that generates quotes. The total time to generate all quotes is about 10 secs, and at present provides an unacceptable user experience.
What I want to do is multi-thread each quote so the user can see results as they come in. The problem is that the app I've inherited does a lot of bus logic on the d...
Hi,
I want to insert the data in my table tblSubscriptions and I only want to use one insert statement.
I am going to insert data for every userId in User Table. The following SQL doesnot work.
Insert tblSubscriptions (UserID, ProductID, isACtive, SubscriptionDays, Price, MonthlyPrice, ProductType, CurrencyID)
Values ((Select userID Fr...
i have a table having
create table test(id int not null primary key, day date not null);
insert into test(id, day) values(1, '2006-10-08');
insert into test(id, day) values(2, '2006-10-08');
insert into test(id, day) values(3, '2006-10-09');
select * from test;
+----+------------+
| id | day |
+----+------------+
| 1 | 2006-1...
Hi,
i am storing an image in a table in varbinary(max) format, actually first time it will be empty,i am checking whether it is empty of not but while checking for null field i am getting any exception stating invalid cast so can any one suggest what is the problem with this.
code sample is
con = new SqlCeConnection(CommonClass.Conn...
I have a table which has fields (id, parent_id, name, created_at). I want to write a query to select id, name, created_at, parent_created_at. The 'parent_created_at' is the 'created_at' field for the records matching parent (if it has one - i.e. the records parent_id >0), otherwise the 'parent_created_at' field should be null. Any sugges...
id | photo title | created_date
XEi43 | my family | 2009 08 04
dDls | friends group | 2009 08 05
32kJ | beautiful place | 2009 08 06
EOIk | working late | 2009 08 07
Say I have the id 32kJ. How would I get the new or previous row?
...
Here is a brief description of the tables I'm working with in Oracle 10g:
Notes:
Table : jnldetail : Single row with data as shown.
There are multiple package id's attached to the same bill_ref_no for an account. Therefore, I'm trying to update "jnldetail " with the multiple package_id's.
Relation between index_bill_ref and bill_ref_n...
I worked on a parser for arithmetic expressions.
The key there was building a syntax tree, where leaves are variables and nodes are operators.
Not I'm thinking about parsing SQL queries. Parsing simple select won't be a problem, but I'm not pretty sure about the complex queries.
Can you point me to a good reference about sql parsing. T...
Hi All,
I am using
declare @insertsql nvarchar(MAX)
--above @insertsql for sp_executesql takes only nvarchar as input
set @insertsql='--i am giving More than 10000 characters here -----'
EXEC sp_executesql @insertsql, N'@inXMLRequest XML OUTPUT', @inXMLRequest OUTPUT
how to insert morethan 10000 charecters in NVARCHAR(MAX) in sql...
How to write a query to find the time difference ?
time format is like this
2009-08-12 02:59:59
i want to compare
this time with
2009-08-12 02:59:10
how to check these two
i want to return some row having the time difference is 30sec
how to write a SQL statement ??
...
Imagine table t1 have 2 cols:
col1 col2
--------------
test 900 1
test 901 2
test 902 3
user 901 4
test 909 5
I want to find just one row by 2 params (name, code) where name its (test, user ..etc) and code - (901, 902, null, .. etc).
There could not be more than one row of the same (Code,name) - I Mean there ...
Hello everyone,
I am using VSTS2008 + C# + .Net 3.0. Here is my code and related exception from ADO.Net. Here is my input two strings in both binary form and text form, any ideas what is wrong? Why the two different strings will be treated as the same by ADO.Net?
Exception message:
An unhandled exception of type 'System.Data.Constrain...
I want to pull results and count how many of each name is pulled but without grouping...
for example I want this:
John Doe 3
John Doe 3
John Doe 3
Mary Jane 2
Mary Jane 2
instead of this:
John Doe 3
Mary Jane 2
Does that make sense?
Thanks.
...
Does anyone know of any documentation out there that lays out what SQL functions are supported for the .NET Microsoft.Jet.OLEDB.4.0 provider when querying a text file?
For instance, the TRIM() function. However, there doesn't appear to be a CASE function like in SQL Server.
...