It’s often useful to concatenate two fields together in an SQL query. In PostgreSQL, fields may be concatenated using the || operator. The syntax is really simple. Just place the double bar between the fields you want to join, and (optionally) give a label to that new field. Strings can also be concatenated with the [...]
Posts Tagged ‘server’
Concatenation in PostgreSQL
Posted: 15th June 2010 by Tim in PostgreSQLTags: concat, concatenation, database, PostgreSQL, result, server, SET, sql, string
1
Inline CASE statement in PostgreSQL
Posted: 9th June 2010 by Tim in PostgreSQLTags: case, database, if, PostgreSQL, query, select, server, sql, statement, switch
PostgreSQL, unfortunately, does not provide an inline IF statement like some other SQL servers. CASE statements, however, can be run inline which can be quite handy. Let’s say you have a user table with a num_heads field. You want to know if the user is a zombie, human or alien with one query. This could [...]
Adding subdomains in Apache
Posted: 20th August 2009 by Tim in Apache, UbuntuTags: Apache, asp, configuration, HTML, Javascript, PHP, restart, server, web
There are a number of ways to add subdomains in apache, but here is the quickest and most basic way to get it done. This example is for Ubuntu 8.04, but may be used on other flavours of linux if you find the correct paths to the files. Let’s say you have a blog on [...]