Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

SQLQueriesNoCode

The Yahoo! Groups Product Blog

Check it out!

Group Information

  • Members: 3237
  • Category: SQL
  • Founded: Feb 17, 2003
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

Messages

Advanced
Messages Help
Messages 1862 - 1891 of 4869   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#1862 From: "pengbsam" <pengbsam@...>
Date: Mon Jan 16, 2006 1:37 am
Subject: How to form pivot table
pengbsam@...
Send Email Send Email
 
I am kind of new at it. Only been working with SQl for couple of
month. and I have a weired questions! I have a results view such as
below

type         Qty    station                   expenses
------------ ------ ---------------------- -----------
business     0002   station1                  18722
business     0002   station2                  9564
business     0002   station3                  24278
business     0002   station4                  375
business1    0003   station1                  19566
business1    0003   station2                  NULL
business1    0003   station3                  12066
business1    0003   station4                  12875

but actually I need to turn into format such as

type         Qty    station                  expenses
------------ ------ ---------------------- -----------
business     0002   station1                  18722
                     station2                  9564
                     station3                  24278
                     station4                  375
business1    0003   station1                  19566
                     station2                  NULL
                     station3                  12066
                     station4                  12875

Because if I don't then who ever going to use the query gonna
suspect that they quantity is 8 and 12 pcs where it's actually 2pcs
3 pcs, respectively! Could somebody help me out? I really
appreciated it! Thank you!

#1863 From: BESHOUY GERGES <be_slave4u@...>
Date: Mon Jan 16, 2006 7:18 am
Subject: Re: How to form pivot table
be_slave4u
Send Email Send Email
 
use group by

pengbsam <pengbsam@...> wrote:
I am kind of new at it. Only been working with SQl for couple of
month. and I have a weired questions! I have a results view such as
below

type         Qty    station                   expenses        
------------ ------ ---------------------- -----------
business     0002   station1                  18722      
business     0002   station2                  9564       
business     0002   station3                  24278      
business     0002   station4                  375        
business1    0003   station1                  19566      
business1    0003   station2                  NULL     
business1    0003   station3                  12066      
business1    0003   station4                  12875   

but actually I need to turn into format such as

type         Qty    station                  expenses        
------------ ------ ---------------------- -----------
business     0002   station1                  18722      
                    station2                  9564       
                    station3                  24278      
                    station4                  375        
business1    0003   station1                  19566      
                    station2                  NULL     
                    station3                  12066      
                    station4                  12875   

Because if I don't then who ever going to use the query gonna
suspect that they quantity is 8 and 12 pcs where it's actually 2pcs 
3 pcs, respectively! Could somebody help me out? I really
appreciated it! Thank you!






Yahoo! Photos
Got holiday prints? See all the ways to get quality prints in your hands ASAP.

#1864 From: filzah hanani <unidha@...>
Date: Mon Jan 16, 2006 8:28 am
Subject: Re: How to form pivot table
unidha
Send Email Send Email
 
try
select type,qty,station,expense from tablename group by type

pengbsam <pengbsam@...> wrote:
I am kind of new at it. Only been working with SQl for couple of
month. and I have a weired questions! I have a results view such as
below

type         Qty    station                   expenses        
------------ ------ ---------------------- -----------
business     0002   station1                  18722      
business     0002   station2                  9564       
business     0002   station3                  24278      
business     0002   station4                  375        
business1    0003   station1                  19566      
business1    0003   station2                  NULL     
business1    0003   station3                  12066      
business1    0003   station4                  12875   

but actually I need to turn into format such as

type         Qty    station                  expenses        
------------ ------ ---------------------- -----------
business     0002   station1                  18722      
                    station2                  9564       
                    station3                  24278      
                    station4                  375        
business1    0003   station1                  19566      
                    station2                  NULL     
                    station3                  12066      
                    station4                  12875   

Because if I don't then who ever going to use the query gonna
suspect that they quantity is 8 and 12 pcs where it's actually 2pcs 
3 pcs, respectively! Could somebody help me out? I really
appreciated it! Thank you!






Yahoo! Photos
Got holiday prints? See all the ways to get quality prints in your hands ASAP.

#1865 From: "pengbsam" <pengbsam@...>
Date: Mon Jan 16, 2006 3:54 pm
Subject: Re: How to form pivot table
pengbsam@...
Send Email Send Email
 
view 1 is the result of a group by! Because the first part and the
second part of the view set in different level! even a group by will
still make it look this. Now granded system will know that it's
repeated. However when this result is draged to excel sheet. Then it
will still be combined. Wouldn't it?

#1866 From: "pengbsam" <pengbsam@...>
Date: Mon Jan 16, 2006 3:52 pm
Subject: Re: How to form pivot table
pengbsam@...
Send Email Send Email
 
--- In SQLQueriesNoCode@yahoogroups.com, filzah hanani <unidha@y...>
Yes. but that will still have qty duplicated. System recognize that
it's repeat# in a relational point. But if this view is extracted to
excel and a pivot table ran on it. Then it will still combine them
together!


wrote:
>
> try
>   select type,qty,station,expense from tablename group by type
>
> pengbsam <pengbsam@h...> wrote:
>   I am kind of new at it. Only been working with SQl for couple of
> month. and I have a weired questions! I have a results view such
as
> below
>
> type         Qty    station                   expenses
> ------------ ------ ---------------------- -----------
> business     0002   station1                  18722
> business     0002   station2                  9564
> business     0002   station3                  24278
> business     0002   station4                  375
> business1    0003   station1                  19566
> business1    0003   station2                  NULL
> business1    0003   station3                  12066
> business1    0003   station4                  12875
>
> but actually I need to turn into format such as
>
> type         Qty    station                  expenses
> ------------ ------ ---------------------- -----------
> business     0002   station1                  18722
>                     station2                  9564
>                     station3                  24278
>                     station4                  375
> business1    0003   station1                  19566
>                     station2                  NULL
>                     station3                  12066
>                     station4                  12875
>
> Because if I don't then who ever going to use the query gonna
> suspect that they quantity is 8 and 12 pcs where it's actually
2pcs
> 3 pcs, respectively! Could somebody help me out? I really
> appreciated it! Thank you!
>
>
>
>
>
>
> ---------------------------------
>   YAHOO! GROUPS LINKS
>
>
>     Visit your group "SQLQueriesNoCode" on the web.
>
>     To unsubscribe from this group, send an email to:
>  SQLQueriesNoCode-unsubscribe@yahoogroups.com
>
>     Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
>
>
> ---------------------------------
>
>
>
>
>
>
> ---------------------------------
> Yahoo! Photos
>  Got holiday prints? See all the ways to get quality prints in
your hands ASAP.
>

#1867 From: "peternilsson42" <peternilsson42@...>
Date: Tue Jan 17, 2006 2:39 am
Subject: Re: How to form pivot table
peternilsson42@...
Send Email Send Email
 
"pengbsam" <pengbsam@h...> wrote:
>
> I am kind of new at it. Only been working with SQl for couple of
> month. and I have a weired questions! I have a results view such
> as below
>
> type         Qty    station                   expenses
> ------------ ------ ---------------------- -----------
> business     0002   station1                  18722
> business     0002   station2                  9564
> business     0002   station3                  24278
> business     0002   station4                  375
> business1    0003   station1                  19566
> business1    0003   station2                  NULL
> business1    0003   station3                  12066
> business1    0003   station4                  12875
>
> but actually I need to turn into format such as
>
> type         Qty    station                  expenses
> ------------ ------ ---------------------- -----------
> business     0002   station1                  18722
>                     station2                  9564
>                     station3                  24278
>                     station4                  375
> business1    0003   station1                  19566
>                     station2                  NULL
>                     station3                  12066
>                     station4                  12875

Before the select, do...

   break on "type" skip page on "Qty"

--
Peter

#1868 From: Noman Aftab <noman17pk@...>
Date: Fri Jan 20, 2006 12:09 pm
Subject: DTS not being run when server is down or switched off
noman17pk
Send Email Send Email
 
hi all,
I am using Sql Server 2000, data transformation
services. I have made a package and scheduled it on a
certain time..lets say 4:00 PM, daily.

Is it possible for SQl Server Agent to automatically
tell me that at 4:00 PM, the package was not run.

Or is it possible that it should re-run the package,
when the server is started/restarted?

thanks in advance,
Noman Aftab

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

#1869 From: paul a <itsavm_paul_useful@...>
Date: Sun Jan 22, 2006 7:09 am
Subject: What is the advantage of using oracle instead of xml
itsavm_paul_...
Send Email Send Email
 
Hi,
 
What is the advantage of using oracle instead of xml to store data for applciation development.
 
Currently i am doing a project to implement the ERP, but i am having a confusion to whether to use oracle as database backend or xml?
 
Can anybody help me to know about which one is suitable for which kind of application development?
 
Thanks in advance.
 
With Regards,
Paul


Yahoo! Photos
Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.

#1870 From: "John Warner" <john@...>
Date: Sun Jan 22, 2006 7:13 pm
Subject: RE: What is the advantage of using oracle instead of xml
john@...
Send Email Send Email
 
Oracle scales better is faster and reduces if you do your design work properly  the likelihood of data anomalies. I suspect there are lots of other reasons to use a database (not just oracle) over XML for a data store. XML is really intended as a platform neutral way to share data (send over the internet, disk file via snail mail etc) with other systems. It is not intended to be used as a large scale data store. 
 
John Warner
-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of paul a
Sent: Sunday, January 22, 2006 2:09 AM
To: sqlqueriesnocode
Subject: [SQLQueriesNoCode] What is the advantage of using oracle instead of xml

Hi,
 
What is the advantage of using oracle instead of xml to store data for applciation development.
 
Currently i am doing a project to implement the ERP, but i am having a confusion to whether to use oracle as database backend or xml?
 
Can anybody help me to know about which one is suitable for which kind of application development?
 
Thanks in advance.
 
With Regards,
Paul


Yahoo! Photos
Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.

#1871 From: Narendra okte <meet_narendraokte4u@...>
Date: Thu Jan 26, 2006 7:05 am
Subject: Hi to all
meet_narendr...
Send Email Send Email
 
Dear all,
 
 I    just started to learn sql. I don't know how can  I become a good database handler. Can anyone help me.
 
Thanks and regards,
 Narendra


Send instant messages to your online friends http://in.messenger.yahoo.com


#1872 From: "John Warner" <john@...>
Date: Thu Jan 26, 2006 2:00 pm
Subject: RE: Hi to all
john@...
Send Email Send Email
 
What is it you want here? Your question is a bit broad, is there something specific you need help with?
 
John Warner
-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of Narendra okte
Sent: Thursday, January 26, 2006 2:06 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Hi to all

Dear all,
 
 I    just started to learn sql. I don't know how can  I become a good database handler. Can anyone help me.
 
Thanks and regards,
 Narendra


Send instant messages to your online friends http://in.messenger.yahoo.com


#1873 From: Ruffin Bailey <rufwork@...>
Date: Thu Jan 26, 2006 3:34 pm
Subject: Re: What is the advantage of using oracle instead of xml
rufwork2
Send Email Send Email
 
On 1/23/06 9:57 AM, "SQLQueriesNoCode@yahoogroups.com"
<SQLQueriesNoCode@yahoogroups.com> wrote:

>   What is the advantage of using oracle instead of xml to store data for
> applciation development.
>
>   Currently i am doing a project to implement the ERP, but i am having a
> confusion to whether to use oracle as database backend or xml?
>
>   Can anybody help me to know about which one is suitable for which kind of
> application development?

Sounds like you're using .NET.  You can certainly use XML as a datastore of
sorts, serializing your data to what amounts to text dumps to develop
DataSets around without "selling out" to any particular database management
system, like Oracle.  As Mr. Warner pointed out, this doesn't really scale
well, but if you've written your code well, XML-serialized data can be a
good, generic way of writing jive that will work crossplatform later.  I've
found you can often use manageably-sized datasets for testing for quite some
time into a new project without hitting a live database.

Of course you're likely eventually going to want to hook up to something,
whether it's Access or SQL Server or, at the very high end (SQL Server dba
flames aside; I is one, yo), Oracle, and at point you'll need to write
specific backend code.  If you already know Oracle is your rdbms (relational
database system) of choice, start writing to it now.

Regardless, you'll need to go down that path and select a backend the
questions are specifically "SQL queries" material, I'm afraid.  Which is
just to say that there are a number of very good lists more geared towards
answering questions of needs assessment, I suppose.

Ruffin Bailey

#1874 From: a a <babycatapple@...>
Date: Fri Jan 27, 2006 11:32 am
Subject: Can any one tell me this query?
babycatapple
Send Email Send Email
 
I have a table with the following three columns.
TransID
Amount
DateTime
1000s of Entries are coming per minute. now i need to query Data according to following requriement.
Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.
can any one give me query to solve this.
Thanks


Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, more on new and used cars.

#1875 From: "James Poulose" <James.Poulose@...>
Date: Fri Jan 27, 2006 2:00 pm
Subject: RE: Can any one tell me this query?
James.Poulose@...
Send Email Send Email
 
Hi,
 Add a DateTime column to the table (if it does not exist) which can hold time with seconds and milliseconds. In the query use this information to filter your records.
 
James


From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: 27 January 2006 05:02 PM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Can any one tell me this query?

I have a table with the following three columns.
TransID
Amount
DateTime
1000s of Entries are coming per minute. now i need to query Data according to following requriement.
Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.
can any one give me query to solve this.
Thanks


Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.

#1876 From: "John Warner" <john@...>
Date: Fri Jan 27, 2006 3:04 pm
Subject: RE: Can any one tell me this query?
john@...
Send Email Send Email
 
ANSI SQL may not be capable of this as is, could you tell us the RDBMS you are using (SQL Server, Oracle, MySQL, DB2 etc)?
 
John Warner
-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: Friday, January 27, 2006 6:32 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Can any one tell me this query?

I have a table with the following three columns.
TransID
Amount
DateTime
1000s of Entries are coming per minute. now i need to query Data according to following requriement.
Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.
can any one give me query to solve this.
Thanks


Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.

#1877 From: "Michael Weiss" <mweiss@...>
Date: Fri Jan 27, 2006 5:12 pm
Subject: RE: Can any one tell me this query?
mweiss@...
Send Email Send Email
 

See this link …

http://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=12481&#58064

 

Also, search on Google for “t-sql group by time interval”. You should get several examples of how to do what you are needing to.

Hth,

Michael

 


From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of John Warner
Sent: Friday, January 27, 2006 7:04 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: RE: [SQLQueriesNoCode] Can any one tell me this query?

 

ANSI SQL may not be capable of this as is, could you tell us the RDBMS you are using (SQL Server, Oracle, MySQL, DB2 etc)?

 

John Warner

-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: Friday, January 27, 2006 6:32 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Can any one tell me this query?

I have a table with the following three columns.

TransID

Amount

DateTime

1000s of Entries are coming per minute. now i need to query Data according to following requriement.

Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.

can any one give me query to solve this.

Thanks


Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.


#1878 From: "John Warner" <john@...>
Date: Fri Jan 27, 2006 6:21 pm
Subject: RE: Can any one tell me this query?
john@...
Send Email Send Email
 
You assume SQL Server, what if Oracle or DB2, thus my question.
 
 
John Warner
-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of Michael Weiss
Sent: Friday, January 27, 2006 12:13 PM
To: SQLQueriesNoCode@yahoogroups.com
Subject: RE: [SQLQueriesNoCode] Can any one tell me this query?

See this link …

http://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=12481&#58064

 

Also, search on Google for “t-sql group by time interval”. You should get several examples of how to do what you are needing to.

Hth,

Michael

 


From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of John Warner
Sent: Friday, January 27, 2006 7:04 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: RE: [SQLQueriesNoCode] Can any one tell me this query?

 

ANSI SQL may not be capable of this as is, could you tell us the RDBMS you are using (SQL Server, Oracle, MySQL, DB2 etc)?

 

John Warner

-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: Friday, January 27, 2006 6:32 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Can any one tell me this query?

I have a table with the following three columns.

TransID

Amount

DateTime

1000s of Entries are coming per minute. now i need to query Data according to following requriement.

Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.

can any one give me query to solve this.

Thanks


Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.


#1879 From: "Michael Weiss" <mweiss@...>
Date: Fri Jan 27, 2006 7:19 pm
Subject: RE: Can any one tell me this query?
mweiss@...
Send Email Send Email
 

I wasn’t assuming anything, John, and my reply was not directed at your question regarding the RDBMS. I was simply sending him in the direction of examples of the logic behind the resolution to his problem.

Thank you,

Michael

 


From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of John Warner
Sent: Friday, January 27, 2006 10:22 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: RE: [SQLQueriesNoCode] Can any one tell me this query?

 

You assume SQL Server, what if Oracle or DB2, thus my question.

 

 

John Warner

-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of Michael Weiss
Sent: Friday, January 27, 2006 12:13 PM
To: SQLQueriesNoCode@yahoogroups.com
Subject: RE: [SQLQueriesNoCode] Can any one tell me this query?

See this link …

http://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=12481&#58064

 

Also, search on Google for “t-sql group by time interval”. You should get several examples of how to do what you are needing to.

Hth,

Michael

 


From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of John Warner
Sent: Friday, January 27, 2006 7:04 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: RE: [SQLQueriesNoCode] Can any one tell me this query?

 

ANSI SQL may not be capable of this as is, could you tell us the RDBMS you are using (SQL Server, Oracle, MySQL, DB2 etc)?

 

John Warner

-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: Friday, January 27, 2006 6:32 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Can any one tell me this query?

I have a table with the following three columns.

TransID

Amount

DateTime

1000s of Entries are coming per minute. now i need to query Data according to following requriement.

Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.

can any one give me query to solve this.

Thanks


Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.

 


#1880 From: "Damhuis Anton" <DamhuisA@...>
Date: Mon Jan 30, 2006 5:22 am
Subject: RE: Can any one tell me this query?
tyrebender
Send Email Send Email
 
Hi A A
 
Questions:
How will you execute this query every 15 minutes?
If you can have the external App execute the query reliable every 15 minutes, then it would be something like:
 
Select * from <table> where DateTime between <DateTimeValue> and DateDiff(<DateTimeValue> , -15 , n)
 
Thinking about it, that would happen if you for some or other reason skipped a 15 minute interval. That data would be lost for ever in your report. Maybe that is something to think about.
 
Regards
  Anton
 
 


From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: 27 January 2006 01:32 PM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Can any one tell me this query?

I have a table with the following three columns.
TransID
Amount
DateTime
1000s of Entries are coming per minute. now i need to query Data according to following requriement.
Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.
can any one give me query to solve this.
Thanks


Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.
Confidentiality Warning
=======================
The contents of this e-mail and any accompanying documentation
are confidential and any use thereof, in what ever form, by anyone
other than the addressee is strictly prohibited.

#1881 From: "Balaji Sreenivasan" <balaji_dravid@...>
Date: Mon Jan 30, 2006 11:57 am
Subject: Doubt in Query
balaji_dravid@...
Send Email Send Email
 
How to merge these 2 into a single:

query 1:

UPDATE I_LIMIT SET [cycle no] = "US0010001"
WHERE USERNAME LIKE '*1' or USERNAME LIKE '*2';


query 2:
UPDATE [I_HIGHEST DEBIT] SET [cycle no] = "DE0010001"
WHERE USERNAME LIKE '*3' or USERNAME LIKE '*4';

Please reply to balaji_dravid@...

#1882 From: "A.J. Morales" <ajmorales@...>
Date: Mon Jan 30, 2006 1:23 pm
Subject: Re: Doubt in Query
ajmorales.rm
Send Email Send Email
 
I believe a 'union' query would do the trick!
Just add the word UNION between both queries as 1 query.
 
AJ

Balaji Sreenivasan <balaji_dravid@...> wrote:
How to merge these 2 into a single:

query 1:

UPDATE I_LIMIT SET [cycle no] = "US0010001"
WHERE USERNAME LIKE '*1' or USERNAME LIKE '*2';


query 2:
UPDATE [I_HIGHEST DEBIT] SET [cycle no] = "DE0010001"
WHERE USERNAME LIKE '*3' or USERNAME LIKE '*4';

Please reply to balaji_dravid@...






Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, more on new and used cars.

#1883 From: "John Warner" <john@...>
Date: Mon Jan 30, 2006 1:56 pm
Subject: RE: Doubt in Query
john@...
Send Email Send Email
 
I don't think UNION works the way you want with UPDATEs. Union is when you want to merge the result set from two seemingly unrelated tables/queries. What RDBMS is in use here? I think the answer is going to be some sort of stored proc that will support batch's. Might also look at how the RDBMS in this case handles Transactions.
 
 
John Warner
-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of A.J. Morales
Sent: Monday, January 30, 2006 8:24 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: Re: [SQLQueriesNoCode] Doubt in Query

I believe a 'union' query would do the trick!
Just add the word UNION between both queries as 1 query.
 
AJ

Balaji Sreenivasan <balaji_dravid@...> wrote:
How to merge these 2 into a single:

query 1:

UPDATE I_LIMIT SET [cycle no] = "US0010001"
WHERE USERNAME LIKE '*1' or USERNAME LIKE '*2';


query 2:
UPDATE [I_HIGHEST DEBIT] SET [cycle no] = "DE0010001"
WHERE USERNAME LIKE '*3' or USERNAME LIKE '*4';

Please reply to balaji_dravid@...






Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.

#1884 From: a a <babycatapple@...>
Date: Mon Jan 30, 2006 2:57 pm
Subject: RE: Can any one tell me this query?
babycatapple
Send Email Send Email
 
Dear, i dont want single row, i want rows grouped by 15 min interval.

Damhuis Anton <DamhuisA@...> wrote:
Hi A A
 
Questions:
How will you execute this query every 15 minutes?
If you can have the external App execute the query reliable every 15 minutes, then it would be something like:
 
Select * from <table> where DateTime between <DateTimeValue> and DateDiff(<DateTimeValue> , -15 , n)
 
Thinking about it, that would happen if you for some or other reason skipped a 15 minute interval. That data would be lost for ever in your report. Maybe that is something to think about.
 
Regards
  Anton
 
 


From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: 27 January 2006 01:32 PM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Can any one tell me this query?

I have a table with the following three columns.
TransID
Amount
DateTime
1000s of Entries are coming per minute. now i need to query Data according to following requriement.
Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.
can any one give me query to solve this.
Thanks

Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.
Confidentiality Warning
=======================
The contents of this e-mail and any accompanying documentation
are confidential and any use thereof, in what ever form, by anyone
other than the addressee is strictly prohibited.


Bring words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.

#1885 From: a a <babycatapple@...>
Date: Mon Jan 30, 2006 3:09 pm
Subject: RE: Can any one tell me this query?
babycatapple
Send Email Send Email
 
SQL Server 2000

John Warner <john@...> wrote:
ANSI SQL may not be capable of this as is, could you tell us the RDBMS you are using (SQL Server, Oracle, MySQL, DB2 etc)?
 
John Warner
-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: Friday, January 27, 2006 6:32 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Can any one tell me this query?

I have a table with the following three columns.
TransID
Amount
DateTime
1000s of Entries are coming per minute. now i need to query Data according to following requriement.
Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.
can any one give me query to solve this.
Thanks

Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.


Bring words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.

#1886 From: Dave May <dave.may@...>
Date: Mon Jan 30, 2006 3:22 pm
Subject: RE: Can any one tell me this query?
dave.may@...
Send Email Send Email
 

I can't take credit for the solution, but the post by FrankKalis at the bottom of this forum thread over at sql-server-performance.com should take care of your needs.  Just had to do this last week for a report that I was writing, it works like a champ.

 

http://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=12481&#58064

 

GROUP BY DATEADD(minute, DATEDIFF(minute,0,< your_column >) / < some_value >* < some_value >,0)

 

Where some_value can be replaced with your interval.

 

Dave.

 

-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: Monday, January 30, 2006 9:58 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: RE: [SQLQueriesNoCode] Can any one tell me this query?

 

Dear, i dont want single row, i want rows grouped by 15 min interval.

Damhuis Anton <DamhuisA@...> wrote:

Hi A A

 

Questions:

How will you execute this query every 15 minutes?

If you can have the external App execute the! query reliable every 15 minutes, then it would be something like:

 

Select * from <table> where DateTime between <DateTimeValue> and DateDiff(<DateTimeValue> , -15 , n)

 

Thinking about it, that would happen if you for some or other reason skipped a 15 minute interval. That data would be lost for ever in your report. Maybe that is something to think about.

 

Regards

  Anton

 

 

 


From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: 27 January 2006 01:32 PM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Can any one tell me this query?

I have a table with the following three columns.

TransID

Amount

DateTime

1000s of Entries are coming per minute. now i need to query Data according to following requriement.

Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.

can any one give me query to solve this.

Thanks


Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.

Confidentiality Warning
=======================
The contents of this e-mail and any accompanying documentation
are confidential and any use thereof, in what ever form, by anyone
other than the addressee is strictly prohibited.

 


Bring words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.


#1887 From: "John Warner" <john@...>
Date: Mon Jan 30, 2006 3:56 pm
Subject: RE: Can any one tell me this query?
john@...
Send Email Send Email
 
I don't think there is anyway to do this outside of looping through the records (SELECT col1, col2, ... FROM table WHERE your qualification). In SQL Server create a cursor and just do it. I'm a procedural language kinda guy so I would tend to want to do this within my code. But I don't believe GROUP BY supports any sort of where clause, so you'll have to do it yourself either in a Proc or in your favorite language, VB, C++ etc.
 
 
John Warner
-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: Monday, January 30, 2006 9:58 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: RE: [SQLQueriesNoCode] Can any one tell me this query?

Dear, i dont want single row, i want rows grouped by 15 min interval.

Damhuis Anton <DamhuisA@...> wrote:
Hi A A
 
Questions:
How will you execute this query every 15 minutes?
If you can have the external App execute the query reliable every 15 minutes, then it would be something like:
 
Select * from <table> where DateTime between <DateTimeValue> and DateDiff(<DateTimeValue> , -15 , n)
 
Thinking about it, that would happen if you for some or other reason skipped a 15 minute interval. That data would be lost for ever in your report. Maybe that is something to think about.
 
Regards
  Anton
 
 


From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: 27 January 2006 01:32 PM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Can any one tell me this query?

I have a table with the following three columns.
TransID
Amount
DateTime
1000s of Entries are coming per minute. now i need to query Data according to following requriement.
Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.
can any one give me query to solve this.
Thanks

Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.
Confidentiality Warning
=======================
The contents of this e-mail and any accompanying documentation
are confidential and any use thereof, in what ever form, by anyone
other than the addressee is strictly prohibited.


Bring words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.

#1888 From: "John Warner" <john@...>
Date: Mon Jan 30, 2006 3:58 pm
Subject: RE: Can any one tell me this query?
john@...
Send Email Send Email
 
Well thank you for a real lesson in SQL. I was unaware (as my previous post indicates) that you could do this in a GROUP BY clause.  I always learn things from this list, but this one today is a biggie. Thank you again.
 
 
John Warner
-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of Dave May
Sent: Monday, January 30, 2006 10:23 AM
To: 'SQLQueriesNoCode@yahoogroups.com'
Subject: RE: [SQLQueriesNoCode] Can any one tell me this query?

I can't take credit for the solution, but the post by FrankKalis at the bottom of this forum thread over at sql-server-performance.com should take care of your needs.  Just had to do this last week for a report that I was writing, it works like a champ.

 

http://www.sql-server-performance.com/forum/topic.asp?TOPIC_ID=12481&#58064

 

GROUP BY DATEADD(minute, DATEDIFF(minute,0,< your_column >) / < some_value >* < some_value >,0)

 

Where some_value can be replaced with your interval.

 

Dave.

 

-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: Monday, January 30, 2006 9:58 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: RE: [SQLQueriesNoCode] Can any one tell me this query?

 

Dear, i dont want single row, i want rows grouped by 15 min interval.

Damhuis Anton <DamhuisA@...> wrote:

Hi A A

 

Questions:

How will you execute this query every 15 minutes?

If you can have the external App execute the! query reliable every 15 minutes, then it would be something like:

 

Select * from <table> where DateTime between <DateTimeValue> and DateDiff(<DateTimeValue> , -15 , n)

 

Thinking about it, that would happen if you for some or other reason skipped a 15 minute interval. That data would be lost for ever in your report. Maybe that is something to think about.

 

Regards

  Anton

 

 

 


From: SQLQueriesNoCode@yahoogroups.com [mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of a a
Sent: 27 January 2006 01:32 PM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Can any one tell me this query?

I have a table with the following three columns.

TransID

Amount

DateTime

1000s of Entries are coming per minute. now i need to query Data according to following requriement.

Fetch sum of amounts with interval of 15 min That is rows fetched will be 15 min interval apart.The query will be grouped by 15 min interval.

can any one give me query to solve this.

Thanks


Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.

Confidentiality Warning
=======================
The contents of this e-mail and any accompanying documentation
are confidential and any use thereof, in what ever form, by anyone
other than the addressee is strictly prohibited.

 


Bring words and photos together (easily) with
PhotoMail - it's free and works with Yahoo! Mail.


#1889 From: Virtual Fission <vfission@...>
Date: Tue Jan 31, 2006 1:04 am
Subject: RE: Can any one tell me this query?
vfission
Send Email Send Email
 
Hi

I am given a date and maturity as in 01-27-2006 and
05/15/2030

I must compute the number of days between 11-15-2005
and
05-15-2006
and the number of days between 11-15-2005 and
01-27-2006.

If anyone has any ideas how I might go about doing
this
please advise.

Thank you
--
vF

#1890 From: "ajay_vetal29" <ajay_vetal29@...>
Date: Tue Jan 31, 2006 1:30 am
Subject: Fwd: RE: Hi to all
ajay_vetal29
Send Email Send Email
 
--- In SQLQueriesNoCode@yahoogroups.com, "John Warner" <john@j...>
wrote:

What is it you want here? Your question is a bit broad, is there
something specific you need help with?

John Warner

-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com
[mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of Narendra okte
Sent: Thursday, January 26, 2006 2:06 AM
To: SQLQueriesNoCode@yahoogroups.com
Subject: [SQLQueriesNoCode] Hi to all


Dear all,

  I    just started to learn sql. I don't know how can  I become a good
database handler. Can anyone help me.

Thanks and regards,
  Narendra



Send instant messages to your online friends
http://in.messenger.yahoo.com


   _____

YAHOO! GROUPS LINKS



*  Visit your group "SQLQueriesNoCode
<http://groups.yahoo.com/group/SQLQueriesNoCode> " on the web.


*  To unsubscribe from this group, send an email to:
  SQLQueriesNoCode-unsubscribe@yahoogroups.com
<mailto:SQLQueriesNoCode-unsubscribe@yahoogroups.com?
subject=Unsubscribe
>


*  Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> .


   _____

--- End forwarded message ---

#1891 From: Dave May <dave.may@...>
Date: Tue Jan 31, 2006 1:40 am
Subject: RE: Can any one tell me this query?
dave.may@...
Send Email Send Email
 
You didn't specify which RDBMS you are using, but if using SQLServer the
solution is very straightforward.  Lookup datediff in BOL for more
information.

	 select datediff(day, '11-15-2005', '05-15-2006')
	 select datediff(day, '11-15-2005', '01-27-2006')

Dave.

-----Original Message-----
From: SQLQueriesNoCode@yahoogroups.com
[mailto:SQLQueriesNoCode@yahoogroups.com] On Behalf Of Virtual Fission
Sent: Monday, January 30, 2006 8:05 PM
To: SQLQueriesNoCode@yahoogroups.com
Subject: RE: [SQLQueriesNoCode] Can any one tell me this query?


Hi

I am given a date and maturity as in 01-27-2006 and
05/15/2030

I must compute the number of days between 11-15-2005
and
05-15-2006
and the number of days between 11-15-2005 and
01-27-2006.

If anyone has any ideas how I might go about doing
this
please advise.

Thank you
--
vF



Yahoo! Groups Links

Messages 1862 - 1891 of 4869   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help