Re: Compare the resulta of a count sql into bash

From: Jasen Betts <jasen(at)xnet(dot)co(dot)nz>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Compare the resulta of a count sql into bash
Date: 2011-01-27 10:20:06
Message-ID: ihrgsm$c74$1@reversiblemaps.ath.cx
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 2011-01-26, manuel antonio ochoa <manuel8aalfaro(at)gmail(dot)com> wrote:
> --0015174be152ceb275049ac2dc95
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hello,
> I have the next :
>
> COUNTONE=`/var/lib/pgsql/bin/./psql -U 'Thor' -d princlocal -p 5432 -h
> 192.170.1.82 -c "select count(*) from monterrey.${NOMBRETB}"`
> COUNTTWO=`/var/lib/pgsql/bin/./psql -U 'Thor' -dprinclocal -p 5432 -h
> 192.170.1.82 -c "select count(*) from monterrey.$nombre where recibo
> between '$FI' and '$FF'"
>
> I want to compare the result countone with countwo how does it works ?

you need -t

COUNTONE=`/var/lib/pgsql/bin/./psql -t -U 'Thor' -d princlocal -p 5432 -h 192.170.1.82 -c "select count(*) from monterrey.${NOMBRETB}"`
COUNTTWO=`/var/lib/pgsql/bin/./psql -t -U 'Thor' -d princlocal -p 5432 -h 192.170.1.82 -c "select count(*) from monterrey.$nombre where recibo between '$FI' and '$FF'"`

or like this:

CONN="user=Thor database=princlocal port=5432 host=192.170.1.82"
PSQL=/var/lib/pgsql/bin/psql
COUNTONE=`$PSQL "$CONN" -t -c "select count(*) from monterrey.${NOMBRETB}"`
COUNTTWO=`$PSQL "$CONN" -t -c "select count(*) from monterrey.$nombre where recibo between '$FI' and '$FF'"`

--
⚂⚃ 100% natural

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Sim Zacks 2011-01-27 10:56:01 Re: Queyring for columns which are exist in table.
Previous Message Thom Brown 2011-01-27 10:08:31 Re: Queyring for columns which are exist in table.