Re: [SQL] Selecting values from comma separated string

2009-08-26 Thread Nacef LABIDI
Here I come again to ask how can I pass an array of values to a pgsql function when I call this function from a delphi program for example. Nacef On Wed, Aug 26, 2009 at 3:05 PM, Tom Lane wrote: > "A. Kretschmer" writes: > > In response to Nacef LABIDI : > >> I w

[SQL] Selecting values from comma separated string

2009-08-26 Thread Nacef LABIDI
Hi all, I want to write a function that takes as param a comma separated values string and perform a select matching these values. Here is the string '1,3,7,8' And I wan to perform a : SELECT * FROM my_table WHERE id IN (1, 3, 7, 8); Does anyone have a clue ? Thanks Nacef

[SQL] Performing intersection without intersect operator

2008-10-28 Thread Nacef LABIDI
Hi all, I want to perform an intersection between several select queries but without using the INTERSECT keyword. select userid from orders where productid=1 INTERSECT select userid from orders where productid=2 I want to transform it without the INTERSECT. Thanks to all Nacef

Re: [SQL] Concat field result in select query

2008-08-22 Thread Nacef LABIDI
Thank you, this is all what I need On Fri, Aug 22, 2008 at 4:10 PM, Guillaume Lelarge <[EMAIL PROTECTED]>wrote: > Nacef LABIDI a écrit : > > Hi all, > > > > I was wondering if there is a way to concatenate the results of a field > > in a select to return it as

Re: [SQL] Concat field result in select query

2008-08-22 Thread Nacef LABIDI
any explanations ? On Fri, Aug 22, 2008 at 6:07 PM, Julien Cigar <[EMAIL PROTECTED]> wrote: > array_accum ? > > On Fri, 2008-08-22 at 15:40 +0200, Nacef LABIDI wrote: > > Hi all, > > > > I was wondering if there is a way to concatenate the results of a > &

[SQL] Concat field result in select query

2008-08-22 Thread Nacef LABIDI
Hi all, I was wondering if there is a way to concatenate the results of a field in a select to return it as a single string. Example : my_field -- 1 2 3 select concat_something(my_field) from my_table group by something; the result expected would be someting like that : 1/2/3 (with

[SQL] Select function with set return type

2008-08-18 Thread Nacef LABIDI
Hi all, I am writing some functions with retrun type as a SETOF of a datatype that I have defined. How can I test them with a select statement. Doing select my_function(); return set valued function called in context that cannot accept a set Thanks to all Nacef

[SQL] Profiling postgresql queries

2008-07-09 Thread Nacef LABIDI
Hi all, I was wondering if there is any GUI or command line based tool running on windows that could help me to profile PostgreSQL queries performance. It should be able to do live profiling since I want to profile the accesses that my application is doing on the Postgres database. Thanks to all N

[SQL] I invite you to join my Ziki Network !

2008-05-25 Thread Nacef LABIDI
ressemblent. Check out my Ziki at : http://www.ziki.com/en/nacef-labidi?invitation_code=326caad1bf53e404456b406f3da5867d Then use this link to accept the invitation and register for your FREE Ziki account: http://www.ziki.com/en/signup?invitation_code=326caad1bf53e404456b406f3da5867d (or copy and paste

Re: [SQL] Substract queries

2008-05-22 Thread Nacef LABIDI
Thanks to all the EXEPT keyword is what I was looking for On Thu, May 22, 2008 at 5:36 PM, Niklas Johansson <[EMAIL PROTECTED]> wrote: > > On 22 maj 2008, at 17.15, Nacef LABIDI wrote: > >> I was wondering how can I substract result between select queries. I mean >> I

[SQL] Substract queries

2008-05-22 Thread Nacef LABIDI
Hi all, I was wondering how can I substract result between select queries. I mean I want to issue a query that does this : (select * from mytable where condition1) - (select * from mytable where condition2) Thanks to all Nacef

[SQL] currval of sequence "my_seq" is not yet defined in this session

2008-04-28 Thread Nacef LABIDI
Hi all, I am writing some code to get the current value of a sequence using the currval function to use this value in a following insert on another table. But I am having this message "currval of sequence "my_seq" is not yet defined in this session". Can someone explain me what is the problem wit

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Nacef LABIDI
3:15 PM, A. Kretschmer < [EMAIL PROTECTED]> wrote: > am Thu, dem 24.04.2008, um 14:59:47 +0200 mailte Nacef LABIDI folgendes: > > Hi all, > > > > I want to select data from a table according to a date column in my > table. I > > want to select all the rows which hav

Re: [SQL] First day of month, last day of month

2008-04-24 Thread Nacef LABIDI
Actually I want to select all rows whith dates between first day of the month 00:00:00 and last date of the month 23:59:59 On Thu, Apr 24, 2008 at 4:15 PM, Colin Wetherbee <[EMAIL PROTECTED]> wrote: > Frank Bax wrote: > > > Frank Bax wrote: > > > > > Nacef LABID

[SQL] First day of month, last day of month

2008-04-24 Thread Nacef LABIDI
Hi all, I want to select data from a table according to a date column in my table. I want to select all the rows which have date in the current month. So is there a way to get from the actual date the first day and the last day of the month or is there a better method to retrieve all the rows with

Re: [SQL] After updating dataset the record goes to the end of thedataset

2008-04-22 Thread Nacef LABIDI
ds > were > originally inserted into the database. In that case add a serial to your > table and > fetch the records like > SELECT * FROM tbl WHERE 1=1 ORDER BY [myserialfield] > It's not foolproof but will in many cases come close to what you seem to > be trying > to achieve by

Re: [SQL] After updating dataset the record goes to the end of the dataset

2008-04-22 Thread Nacef LABIDI
o all Nacef On Tue, Apr 22, 2008 at 12:15 PM, hubert depesz lubaczewski < [EMAIL PROTECTED]> wrote: > On Tue, Apr 22, 2008 at 12:10:41PM +0200, Nacef LABIDI wrote: > > Yes I don't issue any sort statement, and I indeed want the data to be > show > > as it is stored in the

Re: [SQL] After updating dataset the record goes to the end of the dataset

2008-04-22 Thread Nacef LABIDI
Yes I don't issue any sort statement, and I indeed want the data to be show as it is stored in the database. But after updating a row (I don't update the ID, just some fields), it keeps its same place on the DB but jumps to the end of the dataset and by the way to the end of the DBGrid. Nacef On

[SQL] After updating dataset the record goes to the end of the dataset

2008-04-22 Thread Nacef LABIDI
Hi all, I am using Postgres in a Delphi application through ODBC. I am having an issue with updating records. When I create a dataset to get the records in a table then after I update one of these records and then refresh the dataset, the record goes to the end of the dataset. This is disappointi

Re: [SQL] Get the last inserted id

2008-04-11 Thread Nacef LABIDI
Nice idea but how can I use this in a frontend that I am developing using Delphi and ADO objects ? On Fri, Apr 11, 2008 at 7:41 PM, Scott Marlowe <[EMAIL PROTECTED]> wrote: > On Fri, Apr 11, 2008 at 11:23 AM, Nacef LABIDI <[EMAIL PROTECTED]> wrote: > > Hi all, >

[SQL] Get the last inserted id

2008-04-11 Thread Nacef LABIDI
Hi all, I was wondering if postgres can return the last ID inserted for a table which the primary key is autoincremented. I need to retrieve this ID in my code to continue processing on that inserted row. Thanks to all