I'm trying to develop a CASE statement but I can't get it right. I want to evaluate the following SELECT statement:
SELECT `rate` FROM `rates` WHERE `project` = 105 AND `category` = 'JrPart...
select * from table1 mm, table2 a, table3 b, table4 sp
where mm.id = a.OID AND a.NID = b.NPARENTID AND sp.id = b.oid
I am trying to join two tables to only return all values where the...
I am wondoering how to do a sum query on 2 fields Here is what I have seperately. Right now it sums all Injuries, all Illneses and all Personnel. I would liek to sum it as Personnel Injurie...
I am using the following SQL query to pull matching data. Some of the results may not have data for fields sLatitude and sLongitude. How do I exclude these records when these fields are empt...
Hi,
Really simple question. I have two tables linked by their ID's. One table is a data dump and the other a refernce table. In the data dump there is arond 4900 records. when I do a query to...
Can someone please give me the SQL query that will take a single database field that contains a user's full name (John W. H. Smith) and split it up to last name, first name and then order by l...
Hello,
I need a query that depending on the parameters includes or excludes some search conditions.
For example - in the query below - if the user only provides the last name and the lan...
Creating a query over 2 tables. Both have date fields and I'm summing 2 columns on each of them
I want the query to return
YEAR SUM(ADJ LOSS ADDITION) SUM(ADJ LAE ADDITIONS) SUM(EXP ...
Hi,
I am looking for correct sql to compare date. I have my sql db table "users ". I am trying to get value from table where
last_password_change_date = any date when password for last cha...
Query 1:
select date, code, demand, total_demand from table_a
result :
date code demand
2008/07/01 aaa 10000
2008/07/01 bbb 2000
2008/07/02 bbb 3000
2008/07/02 ccc 4000
200...
I have a query in Access that uses a function to get the month and year from a date field. I pasted the query below. I checked the data type in the table it is querying, and the field is defin...
I have one table that has a column with a State in it and a second column with multiple states and need to join them:
i.e.
Table One Column Table Two Colu...
I have been successful for quite a qhile using xp_smtp_sendmail to generate emails in SQL Server 2005. Now I have tried to add an attachment to the email, and the sproc fails with this error:...
Hi,
Is there anyway to have an update and insert in the same query. I have a table, I need to say something like,
If ID exists in other tbale, update field comment in other table to equal "A...
When I run the below sql script, I get the following error message:
"Server: Msg 141, Level 15, State 1, Line 37
A SELECT statement that assigns a value to a variable must not be combined wi...
I am tyring to produce a sorted list of values with the query attached below.
The function, TransformTextFields, is converting any text in the field [KO_QN_Data.DefectQty (ext)] to Integer...
I keep getting the error:
Server: Msg 241, Level 16, State 1, Line 152
Syntax error converting datetime from character string.
hi all,
just getting my head around a fetch loop...(note: not using proper sql to discribe this problem)
in basic i want my stored procedure to do the following:
-- large set of data contai...
i have a sql looping query attached in the snippet. I have a date field which i want to update using this sql query but i am getting syntax error because i have to add single quotes around t...
Here is a case of tricky query that would need advice. A log of sales orders contains some data fileds, a unique sales order id and a unique customer id. However, the main customer table is ma...
B"H
Say I have a LINQ
<asp:LinqDataSource ID="LinqDataSource4" runat="server"
ContextTypeName="DataClassesDataContext" OrderBy="Serial"
...
My boss is away, and someone is asking me to do his job....I have no idea what I am doing.
OK I have a table: Table_A
And I have two columns: Column_1, and Column_2
I need to create a n...
Hi,
i have a table in TOAD for Oracle, and i need to split some values from 2 columns into several..what i have now is:
RATING value
rating1 100
rating2 200
rating3 300
rating...
I have two tables:
stock_company - which stores an id, name, and symbol of a company - a
stock_history - which stores a company id, date, and value of a stock at that given time - b
I wou...
Hi all, how can I do this so that I get the totals for EACH individual customer, everything works fine in this query, BUT it gives me the total for ALL customers. What can I do to make it so ...