[SQL] SQL query to display like this

2007-08-24 Thread RPK
I have a table with records like this: Date EmpIDADCode ADAmount - 01-Jul-07101 GPF150 01-Jul-07102 GPF.ADV100 01-Jul-07103 GPF200 01-jul-07104

[SQL] Retrieve month from date in SQl query

2007-04-22 Thread RPK
I am using PGSQL 8.2.3 on Windows XP. I have a table called "StudentFeesPayment" with columns "ReceiptNo" and "ReceiptMonthYear". The column, "ReceiptMonthYear" stores date in the format "-mm-dd". I have to find the max(ReceiptNo) where Month of (ReceiptMonthYear)=4. Or whatever month I give.

Re: [SQL] Retrieve month from date

2007-04-20 Thread RPK
What this query will return: Select Extract(Month from 4/20/2007) from dual; I suspect "dual" is not for PGSQL but Oracle. But I need to run the above query. What is the replacement of "dual" in PGSQL. Bart Degryse wrote: > > Please always include the error message you get when something isn

Re: [SQL] Retrieve month from date

2007-04-20 Thread RPK
Thanks both of you, I ran EXPLAIN command on above suggested query and got following result: "Aggregate (cost=2.77..2.79 rows=1 width=10)" " -> Seq Scan on studentfeespayment (cost=0.00..2.77 rows=1 width=10)" "Filter: (date_part('month'::text, (recieptmonthyear)::timestamp without t