in sql you can write something like this :
SELECT * FROM x where pipedn >= 5 AND pipedn <= 10
or
SELECT * FROM table x WHERE pipedn BETWEEN 5 AND 10
these examples show howto use WHERE
if all your tables are same you can do:
SELECT col1, col2 from x UNION ALL SELECT col1 , col2 from table y
this one select two table x and y and creates one results set , you can also SELECT INTO this to new table which then contains x and y table
see: http://msdn.microsoft.com/en-us/library/ms180026.aspx
You can create new table all_data
CREATE TABLE all_data AS (SELECT id , data from x UNION ALL SELECT id, moredata as data from y)
for example http://www.techonthenet.com/sql/index.php seems to have quite good tutorial for basic SQL commands
edit: You can do something like this too
SELECT * from table_data x where x.col1 > 3
table_data x creates alias x for table_data table name, so only thing you need to change between queries is table name. Howto do this in MapInfo , i dont know. Above is just simple SQL
The psql option for executing sql commands is -c
and not -e
. The -e option means (from the psql help):
-e, --echo-queries echo commands sent to server
Because the -e option does not take arguments, your sql command is simply ignored.
What you need is:
-c, --command=COMMAND run only single command (SQL or internal) and exit
Also,this should work:
psql -h localhost -d mb_sed_class -U postgres -c 'CREATE TABLE "Segment_029_2009_x_y_sedclass_dt_topo_25cm" ...........'
For more infos:
psql --help
PS: I'm not working on windows, but I don't think you need to navigate to the bin directory to execute psql. Try removing this from code:
cd C:/Program\ Files/PostgreSQL/9.4/bin;
Best Answer
Use UNION or UNION ALL to build one result from your two selects:
UNION will remove the duplicated rows from the union, UNION ALL will include all.