[SQL] Bucketing Row Data in columns
Hi all, I need help on creating a sql, not a problem even if its pl/sql I have orders table schema is as follow orders(order_id,user_id, create_timestamp, amount) and I want to generate a report like for the past 3 days bucketing purchases i.e SUM(amount) every day in columns i.e result will be having these columns. (user_id, amount_day1, amount_day2, amount_day3) ex: am leaving order_id assume they are auto incrementing and unique, date format dd/mm/ (user_id, create_timestamp, amount) (user1, 01/01/2009,100) (user1, 01/01/2009,100) (user2, 01/01/2009,100) (user2, 02/01/2009,100) (user2, 02/01/2009,100) (user1, 02/01/2009,100) (user2, 03/01/2009,100) (user2, 03/01/2009,100) (user3, 03/01/2009,100) result (user_id, amount_day1, amount_day2, amount_day3) (user1, 200, 200, 0) (user2, 100, 200, 200) (user3, 0, 0, 100) hope you guys got what I am trying to generate through sql. I could get this data in each row, but I want it in columns. Can anyone help me on this? lets assume the buckets are fixed i.e 3 only. but I wish to get them unlimited i.e day 1 to day 20. Regards Sandeep Bandela
[SQL] How to check postgres running or not ?
Hello Sir, I want to know how to check whether postgres database is running or not ? when I give command like ./postmaster -i &, whether all databases in that postgres will run or any one [default] ? If any one, then how to detect that database ? Thanks and regards, Sandeep. - Disclaimer: The contents of this message are confidential and intended to the addressee at the specified e-mail address only. Its contents may not be copied or disclosed to anyone other than the intended recipient. If this e-mail is received in error, please contact Vertex Software Pvt. Ltd immediately on +91 20 4041500 with details of the sender and addressee and delete the e-mail. Vertex Software Pvt. Ltd accepts no responsibility in the event that the onward transmission, opening or use of this message and/or any attachments adversely affects the recipient's systems or data. It is the recipient's responsibility to carry out such virus and other checks as the recipient considers appropriate. - ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
[SQL] Foreign Key relationship between two databases
Hi, I am using postgres 7.3.4. I am new to postgres. I can give foreign key relationship between two tables of same database. Can I give foreign key relationship between tables of two databases ? Plz, let me know if possible & send me how can I do that? Thanks & Regards, Sandeep. - Disclaimer: The contents of this message are confidential and intended to the addressee at the specified e-mail address only. Its contents may not be copied or disclosed to anyone other than the intended recipient. If this e-mail is received in error, please contact Vertex Software Pvt. Ltd immediately on +91 20 4041500 with details of the sender and addressee and delete the e-mail. Vertex Software Pvt. Ltd accepts no responsibility in the event that the onward transmission, opening or use of this message and/or any attachments adversely affects the recipient's systems or data. It is the recipient's responsibility to carry out such virus and other checks as the recipient considers appropriate. - ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
[SQL] URL activation through trigger
Hi, I am using Postgres 7.3.4. I want to write a trigger for insert, update, delete operation on say, user table. This trigger will activate an URL. URL will be as: http://sandeep/Trigger?userid=4&name=sandeep where, userid and password will be parameters to send. They may taken from database say, user table. Is this possible ? How can I do that ? Thanks & Regards, Sandeep - Disclaimer: The contents of this message are confidential and intended to the addressee at the specified e-mail address only. Its contents may not be copied or disclosed to anyone other than the intended recipient. If this e-mail is received in error, please contact Vertex Software Pvt. Ltd immediately on +91 20 4041500 with details of the sender and addressee and delete the e-mail. Vertex Software Pvt. Ltd accepts no responsibility in the event that the onward transmission, opening or use of this message and/or any attachments adversely affects the recipient's systems or data. It is the recipient's responsibility to carry out such virus and other checks as the recipient considers appropriate. - ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
[SQL] Problems with ODBC connections
Hi, I am completely new to postgres and I have some problems with ODBC connection. 1) I am running postgres server in Fedora Linux, and I am planning to connect server from windows client. 2) I have installed 64bit version of postgresql ODBC drivers 3) I am making sure that my postgres is running with -p and -i option to accept remote connections. Still I am getting error saying Connection can not be established. Any quick pointers are highly appreciable. Thanks, Deep.
Re: [SQL] Problems with ODBC connections
Hi, The Error message is like this "Could not connect to server; A connection attempt failed because the connected party did not properly respond after a periord..." I have run postgres with option -i and changed the pg_hba.conf the IPv4 details to 0.0.0.0.0/0 to accept form all clients still facing the same issues. Any suggestions? Thanks, Sandeep. On Mon, Feb 27, 2012 at 8:17 AM, Adrian Klaver wrote: > On Saturday, February 25, 2012 10:05:07 am Sandeep Reddy wrote: > > Hi, > > I am completely new to postgres and I have some problems with ODBC > > connection. > > 1) I am running postgres server in Fedora Linux, and I am planning to > > connect server from windows client. > > 2) I have installed 64bit version of postgresql ODBC drivers > > 3) I am making sure that my postgres is running with -p > and > > -i option to accept remote connections. > > > > Still I am getting error saying Connection can not be established. Any > > quick pointers are highly appreciable. > > > The actual error message would be helpful:)? > A common reason for this is a firewall between the client and server that > is > preventing connection to the server port. > Another reason is a pg_hba.conf that has not been configured to allow > connections > from the client. > > > -- > Adrian Klaver > [email protected] > -- sandeep
[SQL] Tsearch not searching 'Y'
Hello All,
I am trying to get tsearch working for my application but I am facing a
problem when alphabet 'Y' is the in the tsquery.
can anyone please share some light on it.
# SELECT 'hollywood'::tsvector @@ to_tsquery('holly:*');
?column?
--
f
(1 row)
SELECT 'hollywood'::tsvector @@ to_tsquery('holl:*');
?column?
--
t
(1 row)
It works when i put <> in y as below but i don't want to do it that way.
SELECT 'hollywood'::tsvector @@ to_tsquery('holl:*');
?column?
--
t
Thanks in advance
[SQL] Re: Re: [GENERAL] [SQL] Tsearch not searching 'Y'
On Thu, 29 Apr 2010 19:27:33 +0530 wrote
>On Thu, Apr 29, 2010 at 01:13:40PM -0000, sandeep prakash dhumale wrote:
>> Hello All,
>>
>> I am trying to get tsearch working for my application but I am facing a
>> problem when alphabet 'Y' is the in the tsquery.
>>
>> can anyone please share some light on it.
>>
>>
>> # SELECT 'hollywood'::tsvector @@ to_tsquery('holly:*');
>> ?column?
>> --
>> f
>> (1 row)
>>
>> SELECT 'hollywood'::tsvector @@ to_tsquery('holl:*');
>> ?column?
>> --
>> t
>> (1 row)
>>
>>
>> It works when i put <> in y as below but i don't want to do it
that way.
>>
>> SELECT 'hollywood'::tsvector @@ to_tsquery('holl<y>:*');
>> ?column?
>> --
>> t
>>
>> Thanks in advance
>
>That is because the to_tsquery() normalizes the tokens. Here is
>what I get from the default configuration:
>
>db=# select to_tsquery('holly:*');
> to_tsquery
>
> 'holli':*
>(1 row)
>
>db=# select to_tsquery('holl:*');
> to_tsquery
>
> 'holl':*
>(1 row)
>
>It is pretty easy to see why you see the behavior that you do.
>Maybe you need to change your tsearch configuration to match what
>you expect to happen.
>
>Regards,
>Ken
>
>
>--
>Sent via pgsql-general mailing list ([email protected])
>To make changes to your subscription:
>http://www.postgresql.org/mailpref/pgsql-general
>
First of all thanks for your replies Tom and Ken,
I am little newbie to Tsearch so I appologies if I sound a little confuse.
Tom: If i do by casting like you wrote then i ran into case sensitivity issue
also then it does not work for other searches I guess then it sees for exact
matches and not normalize to lexims.
Ken: As you said I need to change my configuration, It would be great if you
can point me out where i can change that configuration
and what about that <y> in the query how does it work, does that
mean to explicitly include y in to_tsquery.
All your help is higly appriciated.
--Sandy
[SQL] Can we convert from Postgres to Oracle !!???
Can we convert from Postgres to Oracle !!??? ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
