Solution is: Use If then for comparison
By design as i Understand you can not do a comparison using CASE with two variables.
I ended up doing something like:
Set @count1 = (select....)
Set @count 2 = (select count(*) from....)
If @count1 = @count 2
.....
Else
.....
I am trying to run below and get this error even though the columns is a integer.???
CAST(@CAMPCOUNT AS INTEGER) IS THE Issue in below query:
DECLARE
@CAMPCOUNT INTEGER,...
SET @SQLinsert = 'INSERT INTO ' + @DBName + 'WAVE_QC_HISTORY
(Exec_ID, Test_Number, Test_Name, Test_Result...
Startdate = starting day of week - Sunday
Enddate = end of week so Saturday
still testing/checking i think i need -
WHEN 0 THEN Convert(date,getdate()-6)
so i came up with below that works but thats a lot of code - is this efficent or any better way?
SELECT
StartDate =
CASE (DATEPART(dw, GETDATE()) + @@DATEFIRST) %7
WHEN 1 THEN Convert(date,getdate()-7)
WHEN 2 THEN Convert(date,getdate()-8)
WHEN 3 THEN Convert(date,getdate()-9)
WHEN 4 THEN...
i would like to select date from a table where the transaction happened in last week (sunday through saturday)
What can i use to day to find out last week Sunday and saturday given running the query today.
thanks
Thanks JarlH with your help i solved it in this way:
select trans_id from (
select a.member_id, max(b.trans_id)as trans_unique_id
from table1 b join table2 a
on a.trans_id = b.trans_id
group by a.member_id
)d
Table 1 (transaction table)
key - tran_id - unique id for this table.
Columns:
tran_id
member_id
Table 2 (member table)
Columns:
member_id
Every time a member does a transcation like deposit, its saved in transaction table.
data-table 1:
tran_id, member_id
1,1
2,1
3,1
4,1
5,2
6,2...
Distinct wont work me as:
-all tran_id are allready distinct
-what is common between them is the member id
so what i really need is a single record for a given member
anyother way to do it?
I have 2 tables:
Table 1: only had TranId - 4 transaction records
Table 2: TranId, Member Id - - 4 transaction records for same member in table 1
I would like to pick a transaction record group by the member id.
Please help me with query. I have tried below - but putting the transaction id in...
i have 2 tables:
Individual: has iid, hid (Individual id, household id)
Order_header: iid, order amount
I want the query to return 1 individual per household who has the hightest order amoount
What if i dont have a last updated column.
Seems like this is a case of bad data.
How can i write a query to randomly pick one of many records for a given sku?
i need distinct part and rest of the fields,
how do i do it?
select part, desc, qty... from partstable
i cant do
select distinct part, desc, qty... from partstable
as I only need one of records in case the part# is repeated
i have a set with radio buttons.
on submit i need to check if one of them is selected then redirect to a page.
following code is giving error:
<form name="q1" method="post" >
<h4>Please answer the following questions:</h4>
1.What is your Education qualifaction?<br>
<input type="radio"...
I have a web service that I need to secure.
Client has asked me to use PKI based security not SSL.
I cant find any decent examples of how to do so.
Any one that has done so ?
http://www.aspfree.com/c/a/VB.NET/Securing-Web-Services-with-X509-Certificates/
Looks like I need:
Client...
I have tried
[WebMethod]
public void Get(int i){}
[WebMethod]
public void Get(int i, string s)
{}
[WebMethod]
It gives an error:
Both Void Get(Int32, System.String) and Void Get(Int32) use the message name 'Get'. Use the MessageName...
I am writing a web service in c# that will have some required and some optional parameters.
How do I specify optional parameters ? so that the wsdl can show it as an optional ?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.