|
SELECT Col1, Col2, Col3
FROM TABLE1 WHERE
Col4 >= ANY
( SELECT Col1 FROM TABLE2 WHERE DateAdded >= '21-Oct-2006')
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi there.i have two button controls on my UI of a web application.i name them as 'previous' and 'next'.when i click on 'previous',i should be able to go to the previous record and when i click the 'next' button,i should be able to go to the next record in an sql server database.i also have two buttons for adding and editing records in a dataset.can i get help in writing code in c# preferably.
thanks.
|
|
|
|
|
hi
use BindingContextConcept and try with this code.Ihope will help for u r requirement and give replay
write in nextbutton_click event
this.BindingContext("nameofDataSet","NameofTable").position= this.bindingContext("NameofDataset","nameoftable").position+1;
this is for prevbutton_click event
this.BindingContext("nameofDataSet","NameofTable").position= this.bindingContext("NameofDataset","nameoftable").position-1;
if the record cursor reaches first record then u can disabl prev and same for next
Have a nice day
|
|
|
|
|
thank u very much.i had also mentioned about adding and editing records.i tried with controlname.databindings.add.but thats not working since i am implementing in a webapplication and that method only seems to work for windows forms.can i get any help in this?
thanks in advance.
|
|
|
|
|
Hi All,
Can we have nested Transcations means one transaction within other ;
what is the difference between rollback Transaction and rollback work in sql
Pls give clarification
WINNING IS NOT OUR DREAM, IT'S A HABIT,
HAVE A NICE DAY
|
|
|
|
|
You can nest transactions and roll them back using ROLLBACK TRANSACTION. ROLLBACK WORK rolls the transaction back to the top (and sets the transaction count back to 0) regardless of which level of nested transaction you are in.
begin transaction TopTransaction
update table1 where tblid = @id
save transaction innerTransaction
update table2 where tblid = @id
rollback transaction innerTransaction
commit transaction
In this example, the changes to table1 are saved and table2 changes are rolled back.
begin transaction TopTransaction
update table1 where tblid = @id
save transaction innerTransaction
update table2 where tblid = @id
rollback work
In this example, both transactions are rolled back because the rollback work command has been issued.
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
thanks for u r reply ,
But my Question is
begin Transaction1
one or more sql stmt
begin transaction2
one or more sql stmt
end transaction2
end Transaction1
pls confirm once for me
|
|
|
|
|
You can nest transactions. Why not have a try and see what the results of various commit/rollback scenarios are?
the last thing I want to see is some pasty-faced geek with skin so pale that it's almost translucent trying to bump parts with a partner - John Simmons / outlaw programmer
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi
Can anyone tell me if i purchase SQL2005 standard with 5 cals, whether it will allow more than 5 users connected as my numbers are up and down and i dont want to purchase too many cals for startup of project.
I know with sql2000 its ok to go over.
Thanks
Dom
|
|
|
|
|
So I have a database with multiple records with the same agtMast field. What I need to do is select unique agtMast records, but i need the whole record. I know this will select the unique fields...
SELECT DISTINCT agtMast
FROM table_name;
...but it only selects the agtMast field and I need the entire record.
Any help would be greatly appreciated.
Nathan Lindley
|
|
|
|
|
Well, say there are 3 rows
agtMast ID Name Other
One 22 James Other1
One 22 James Other2
Two 22 Bond Whee!
There are 2 distinct values for the agtMast column, but 2 possible sets of values are different. Do you want one row for each agtMast value, and are there specifics as to which one should be selected, or do you want the distinct sets of values (So if One/22/James/Other1 appeared 10 times, you would want it to appear only once, but have One/22/James/Other2 appear as well after the query)
I need some more information as to how you're clarifying the "correct" row.
|
|
|
|
|
Thanks for the reply Drew.
What I am looking for is just one of each of the agtMast (which is the agent's code) records. What the situation is is before on the old system, they listed each agent every time they changed an address (instead of updating, they just added new rows). What I need to do is just get one of the records (1 for each agtMast code, but no more than 1), for the main contact information and if the address is not the current one, it doesn't matter. I would just put the DISTINCT records into a holding table, but i'm not able to grab just a single record for each DISTINCT agtMast.
Thanks again for the reply!
Nathan Lindley
|
|
|
|
|
|
Thanks for the reply Ed.
How can I use group by agtMast if the select includes more columns than the agtMast?
Nathan Lindley
|
|
|
|
|
I don't mean to be condescending, but are you familiar with the GROUP BY clause?
|
|
|
|
|
Well, you can't include a column in the select statement without it being contained in either an aggregate function or containing it in the GROUP BY clause.
Nathan Lindley
|
|
|
|
|
Exactly. I must be missing something on your requirement. You want one record per agtMast, and you want the other columns also. You have to determine what you want from the other columns.
For example:
SELECT agtMast, MAX(CustName), MAX(DateIssued)....
FROM table_name;
|
|
|
|
|
Yea, I used MIN(), but what I essentially did was MIN(column1) As Column1, etc.. and inserted the records into a temp table, cleared the original table, and then loaded the records back into the original table. I don't know why I didn't do this in the first place, but i guess i was looking for a more concrete way to do it. Oh well, this works.
Thanks again for the responses!
Nathan Lindley
|
|
|
|
|
Hi all.
I had some problems with my previous SQLserver so I decided to uninstall it.
I uninstalled SQLserver from add/remove in control pannel. also there was a folder named microsoft sqlserver in C/program files , I deleted that folder too .
then,I restarted my PC . after that,I put the CD and wanted to install it again...but aftar I clicked on the first "next"button,it was an error and didnt install :
the error is this : "a previous program installation created pending file operations on the installation machine.You must restart the computer before running setup"
but I restarted many times but the error is still here and I cant install the SQlserver.
please help me and answer me ... what should I do ?
|
|
|
|
|
|
thank u very much.
I have installed the SQL server 2000 but I have problem...
I cant register a new sql server ... the connection failed error has appeare on my local . why ?
I dont have any sql or database in enterprise. please help me.
thanks alot
|
|
|
|
|
i am new to asp/sql and of course, i have some problems with it.
please let me explain:
i have a problem with a sql result and its output in asp
my sql result table looks like this
city date payment total
================================================
city1 1/1/2007 Visa 123.32
city1 1/1/2007 Mastercard 23.30
city1 1/1/2007 AMEX 40.30
city1 1/2/2007 Mastercard 12.30
city1 1/2/2007 AMEX 234.20
city2 1/1/2007 Visa 111.11
city2 1/1/2007 AMEX 222.22
city2 1/3/2007 Visa 233.33
city3 1/1/2007 Visa 123.23
city3 1/1/2007 Mastercard 45.34
....
and so forth
there are 3 fix payment options I want to show always: Visa, Mastercard
and AMEX.
I would like to output this result table shown before as followed in
asp:
First sorted by city, then date, and then always followed by 3 fixed
columns for the payment types
City1 Visa Mastercard Amex
-------------------------------------------------------------------
1/1/2007 123.32 23.30 40.30
1/2/2007 - 12.30 234.20
next city
City2 Visa Mastercard Amex
-------------------------------------------------------------------
1/1/2007 111.11 - 222.22
1/3/2007 233.33 - -
next city
City3 Visa Mastercard Amex
-------------------------------------------------------------------
1/1/2007 111.11 - 222.22
1/3/2007 233.33 - -
I tried it with looping while checking if date and city changed.
however, every time i try it, i can't show it properly like the way i
want it.
Please, can somebody help?
If you need more information, please let me know.
thank you so much.
|
|
|
|
|
select City, PaymentDate,
sum(case PaymentType when 'Visa' then PaymentTotal else 0 end) as Visa,
sum(case PaymentType when 'Mastercard' then PaymentTotal else 0 end) as Mastercard,
sum(case PaymentType when 'Amex' then PaymentTotal else 0 end) as Amex
from PaymentTable
group by City, PaymentDate
order by City, PaymentDate
|
|
|
|
|
Thank you so much Andy!
I really appreciate this, that made my day.
Thanks
|
|
|
|
|
Hi,
Need a simple create table script for SQL server 2007.
Here's the structure:
Column1: primary key, integer, auto increment
Column2: Name, char, length 100, not null
Column3: address, char length 200, not null
Please help
ASP - AJAX is SEXY. PERIOD.
|
|
|
|