This is a small post describing the PostgreSQL query for inserting data into a table using Select Query, as I had to use it for solving some issue in one of my projects. So, the query is below :
INSERT INTO films (code, title, did, date_prod, kind)
VALUES ('T_601', (SELECT title from FilmCode where id = 'T_601') ,
106, '1961-06-16', 'Drama');
So, what you have to basically do is to put the ‘Select’ query in round brackets () and execute the query [ The brackets are the main thing to watch out for, as, otherwise the query will give an error on execution.]. The required value will be fetched from the source table and inserted into the desired table.
Hope this helps 🙂
If you trying to connect to a database, directory server or for any server for that matter and while you are running your application server, you are getting the Error message “
Connection timed out“ in the stack trace, then, try the following remedies and see if these can help you :
1. Check in your configuration file whether you have given the correct IP address and port number of the server your trying to connect to.
2. Check if the credentials i.e. usernames and passwords are correct or not.
3. Unblock the ports of the server which you want to access in the firewall of the server.
Try running the application server once again and see if this helps or not.
The WordPress.com stats helper monkeys prepared a 2012 annual report for this blog.
Here’s an excerpt:
4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 15,000 views in 2012. If each view were a film, this blog would power 3 Film Festivals
Click here to see the complete report.
I came across this error when I tried to update my RubyGems because my Rails wanted version 1.3.1 and I was having 1.2.0.
When I wrote “sudo gem update –system” on the terminal I came across the following error :
/usr/bin/gem:23: uninitialized constant Gem::GemRunner(NameError)
So the solution is to add require ‘rubygems/gem_runner’ line to /usr/bin/gem . If you don’t know how to do this or if you are a newbie, don’t worry, I am explaining it below .
Step 1 : Go to the terminal and type the following
$ cd /usr/bin/
This will move you to the folder /usr/bin/
Step 2 : Type the following command to open up file in text editor
$ sudo pico gem and enter your password
Step 3 : Add the line ‘rubygems/gem_runner’ to the gem file that opens up after Step 2 ,
Add the line before require ‘rubygems’
Step 4 : Press Ctrl+X to save the file and exit
4a) Press ‘Y’ if you think you have done the relevant changes correctly and want to save the file. Otherwise,
Press ‘N’ and move out without saving.
4b) If you press ‘Y’ in the previous step, it will ask you if you want to save the file with same name? , Just
press ‘Enter’ and move out.
I hope this solution will help you to solve your problem. I was successful in solving my problem on my Ubuntu 8.04.