|
So I will have to do something like this?
Provider=OraOLEDB.Oracle;Host=xxx.xxx.xxx..xxx;Port=1521;Data Source=MyOracleDB;User Id=myUsernameassword=myPassword;
Do I still need the "Data Source" option?
|
|
|
|
|
hi,
i have .rdlc report. which is grouped on a field. Every thing is working fine except one that same group contents print on two different pages. My mean is that some contents of same group print at bottom part of page & remaining contents print on top part of next page.
i want to shift whole contents of group to top part of next page (if there r not enough space at bottom part of current page). is there r any option to Keep together group ?(as in crystal report)
i think u properly understand my problem.
Please guide me or provide me some link . any help will be greately appreciated.
thanks in advance
Rupesh Kumar Swami
Software Engineer,
Integrated Solution,
Bikaner (India)
|
|
|
|
|
Hi All
What is wrong in this Query I want only one record of a customer. If he have many records.
If I remove the othere tables from the queyr then it works fine.
SELECT DISTINCT cust_order.customer_id AS cust_id, cust_order.order_id AS order_id, customers.fname AS fname, customers.lname AS lname, cust_order.order_date AS order_date, cust_order.order_status AS order_status
FROM cust_order, customers, cust_debit
WHERE customers.customer_id=cust_order.customer_id and cust_order.order_id = cust_debit.order_id and cust_debit.amount >=2000;
pls help me.
Thanks in Advance.
|
|
|
|
|
The DISTINCT works across all the columns you have selected. If you only want one row per customer you are going to have to define which particular row you want to take the rest of the data from.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
|
The "DISTINCT" keyword tells SQL-Server to return unique rows. Your query is basically returning one row per order.
select latest_order.customer_id AS cust_id
latest_order.order_id AS order_id,
customers.fname AS fname,
customers.lname AS lname,
latest_order.order_date AS order_date,
latest_order.order_status AS order_status
from customers
inner join (
select lastest_order_id.customer_id, lastest_order_id.order_id,
lastest_order_id.order_date, latest_order_id.order_status
from (
select customer_id, max(order_id)
from cust_order
group by customerId
) as lastest_order_id
inner join cust_order
on cust_order.order_id = lastest_order_id.order_id
) as latest_order
on latest_order.customer_id = customers.customer_id Note that the above SQL does not refer to your "cust_debit" table because I cannot tell whether it has a one-to-one or a one-to-many relationship with your "cust_orders" table. You will need to modify the "lastest_order_id" inline-view in the above SQL to handle this restriction.
Hope that helps.
Andy
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message".
|
|
|
|
|
Thank u very much its realy helpful.
I m realy very thankful to u .
|
|
|
|
|
You deserve FIVE(5) and you allready get it by me, even though the soulution wasn't for me.
I Love SQL
|
|
|
|
|
Hi,
i hava dataGrid of 100,000 record ,i want to update the Edited data in the
Oracle DataBase,but i dont want to use the Adapter.update() method ,i want to
send the whole data to my storedProcedur and that procedure will update the Record in the database.
best regards
nabeel
|
|
|
|
|
Is this[^] what you want?
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message".
|
|
|
|
|
hi
i have a problem here
i have a column in database the data type is DateTime
i insert into this column Time only LIKE " 09 : 00 AM "
but after i insert data it stores in table date with the time i entered
the problem is
i want to select the data from this column as Time Only
i try this select convert(smalldatetime ,ExamTime,108)
but i back by the date also
how can solve my problem
thnx 4 help
MD_NADA
|
|
|
|
|
did you try to convert in varchar type?
select convert(varchar,ExamTime,108)
I Love SQL
|
|
|
|
|
One quick question
I am using this
replace(convert(varchar(16),cast([WEEK] as datetime),111),' ','-')
How does it differ from
Blue_Boy wrote: select convert(varchar,ExamTime,108)
??
I was born dumb!!
Programming made me laugh !!!
--sid--
|
|
|
|
|
Another option would be to store the time as a number, and when you retrieve it from your database, you can format it in your own way. For example, I store time fields as 6 digit numbers. The first two digits for the hour (military time) the second two digits as minutes, and the last two digits as seconds. So when I store them to my data base I only have to take the datetime object and do this:
myDataBaseRow("myTimeColumn") = objDateTime.ToString("HHmmss")
I know this isn't what you asked for, but I thought another view point might be helpful.
|
|
|
|
|
Hi all,
I can able to fetch a single data from Sql and display it in the Excel sheet using Macro, this is the code.
I am getting in the Text Box:
sno = TextBox1.Text
When i am clicking the Ok button:
Query = "Select sname,scity from smaster where snum='" & sno & "'"
Set QueryRs = oConn.Execute(Query)
Sheet1.Cells(1, 1) = QueryRs("sname")
Sheet.Cells(1, 2) = QueryRs("scity")
Result:
Name, city displayed in the Excel sheet1
Now my problem is how to fetch multiple data and display (like how to use loop in it)
waiting for timely help
Tech_spidy
|
|
|
|
|
|
Hi
I have created one table in sql server as
sno name desc
5 suma dckdfjdskfldkf;dsf
3 suma lklkjdkjfkjfdjbbbbb
8 suma jsakdksladksadks
4 manu nsdskdjsdsadl
2 manu klswkqewr
1 manu shdjsdksd
like this....
now i want to dispaly one record fro each user (i.e the record which is having max sno for each user)
i.e
8 suma jsakdksladksadks
4 manu nsdskdjsdsadl
how to write query for this
plz help me
Thanks in advance
Haritha
|
|
|
|
|
Here is the bit that will get the highest sno for each user
SELECT MAX(sno) AS sno, name FROM MyTable GROUP BY name
Add that as a subquery and join on to it like another table. Like this:
SELECT s.sno, s.name, m.desc
FROM MyTable AS m
INNER JOIN (SELECT MAX(sno) AS sno, name FROM MyTable GROUP BY name) AS s
ON s.sno = m.sno AND s.name = m.name
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
for this you have to use corolated queries following the example
SELECT sno, name, desc FROM WHERE sno=(SELECT MAX(sno) FROM Thanks
Warm Regards
Prakash-B
|
|
|
|
|
PrakashBhaskar wrote: for this you have to use corolated queries following the example
SELECT sno, name, desc FROM <table name> WHERE sno=(SELECT MAX(sno) FROM <table mame)
I think ur problem has solved
That will return the row "8 suma jsakdksladksadks " only.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
i am sorry i have mis-understood the question
Thanks
Warm Regards
Prakash-B
|
|
|
|
|
You can use following query
select max(no),name from trial1
group by name
If have any questions, thn let me know
|
|
|
|
|
d_d_jadhav wrote: You can use following query
select max(no),name from trial1
group by name
If have any questions, thn let me know
No, that will result in:
8 suma
only. Which does not match the output the OP requested.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
You can use following query
select max(no),name from trial1
group by name
If have any questions, thn let me know
Dipti Jadhav
|
|
|
|
|
One post is enough.
Regards,
Satips.
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Walk beside me, and just be my friend. - Albert Camus
|
|
|
|