Menu
  • HOME
  • TAGS

Formatting dates in PostgreSQL

sql,postgresql,select,date-formatting

You can use the to_char function to format your column: SELECT TO_CHAR(ddatte, 'dd/Mon/yyyy') FROM mytable ...

How to select a range of my table

mysql,sql,select,range

I have to head out but if your data looks like this with the ID column: +---------+----------+----+ | word | number | ID | --------------------------- | jack | 1 | 1 | | jack | 2 | 2 | | jack | 3 | 3 | | ali | 1...

Does FD_ISSET() return the file descriptor which received data

c++,c,linux,sockets,select

From the POSIX standards reference page on select: FD_ISSET(fd, fdsetp) shall evaluate to non-zero if the file descriptor fd is a member of the set pointed to by fdsetp, and shall evaluate to zero otherwise. So exactly what the result of FD_ISSET (which is really not a function but a...

SQL Select - Group by along with inner join?

sql-server,select,group-by,inner-join,distinct

You can use ROW_NUMBER with a PARTITION BY clause to identify duplicates: ;WITH CTE AS ( SELECT ROW_NUMBER() OVER (PARTITION BY ITEMNUMBER ORDER BY ROWNUMBER DESC) AS rn, INVENTABLE.ITEMNUMBER, INVENTABLE.ITEMNAME1, INVENTABLE.ITEMNAME2, INVENTABLE.W_TILBUD, INVENTABLE.COSTPRICE, INVENTABLE.VENDITEMNUMBER, INVENTABLE.A_PRODUCENT, INVENTABLE.GROUP_, INVENTABLE.A_GROSSISTLAGER, INVENTABLE.SupplementaryUnits FROM INVENTRANS INNER JOIN INVENTABLE ON INVENTABLE.ITEMNUMBER=INVENTRANS.ITEMNUMBER WHERE INVENTRANS.ACCOUNT='xxx' AND...

psql max group by just for some columns

sql,postgresql,select,max,psql

This is a classic usecase for the group by clause to return only distinct combinations of athlete and category. Then, max(points) could be applied to each combination: SELECT athlete, category, MAX(points) FROM mytable GROUP BY athlete, category ...

group by access seperate column

sql,ms-access,select,group-by

The good news is that your query is perfectly legal (and straight forward!) ANSI SQL, that will work on any sensible database. The bad news is that MS Access which you're using does not support this syntax. It can be worked around with a subquery, though: SELECT t.date, COUNT(*) FROM...

Condition on resultset of a select that return null or not null values-Java

java,sql,select,null

rs.wasNull() is meant to be used for verifying the last read column is NULL or not. If your table's first column is a primitive data type like int it will not return NULL. So in this case you need to verify if the query returns any row or not. For...

Autoupdating Field Based on two