Have a look at this. Using union merges the queries together and sorts them. Logically this is not what you asked for though. Your example was getting a row on either side of the target value. This example gets the next highest and next lowest value relative to the target value. By definition the order of rows do not matter in a relational database table, so one would not really select a row on either side of a value in practice. Hopefully someone with better SQL skills can make this more efficient.
These 2 Users Gave Thanks to gary_w For This Post:
Hello all,
I have a test file that has the format:
.....
O
3.694950 -.895050 1.480000
O
5.485050 .895050 1.480000
Ti
-4.590000 4.590000 2.960000
Ti
-2.295000 ... (5 Replies)
I have a script problem that I am not able to solve due my very limited understanding of unix/awk.
This is the contents of test.sh
awk '{print $1}'
From the prompt if I enter:
./test.sh Hello World
I would expect to see "Hello" but all I get is a blank line. Only then if I enter "Hello... (2 Replies)
hello folks
i have a file that have data like
/test/aa/123
/test/aa/xyz
/test/bb/xyz
/test/bb/123
in above lines i just wants to grep "aa" and "bb".
Thanks,
Bash (4 Replies)
Hi to all.
I'm trying to sort this with the Unix command sort.
user1:12345678:3.5:2.5:8:1:2:3
user2:12345679:4.5:3.5:8:1:3:2
user3:12345687:5.5:2.5:6:1:3:2
user4:12345670:5.5:2.5:5:3:2:1
user5:12345671:2.5:5.5:7:2:3:1
I need to get this:
user3:12345687:5.5:2.5:6:1:3:2... (7 Replies)
Hi UNIX Gurus,
I want to use extract the where clause of a SQL present in a file. Please suggest me how can I do it.
Select * from emp where emp_id>10;
cat <file_name> | grep -i "where" returns whole SQL.
how can I extract only "where emp_id>10;"
Thanks in advance (4 Replies)
Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted!
1. The problem statement, all variables and given/known data:
1. Print the number of people that are in the /etc/passwd file with the name of George
2. Sort by name and... (8 Replies)
Hi All,
I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise.
Eg :
Select 'Query 1 output' from dual;
Select 'Query 2 output' from dual;
I want to... (3 Replies)
Hi, I need to join these statements for efficiency, and without having to make a new directory for each batch. I'm annotating commands below.
wget -q -r -l1 URL
^^ can't use -O - here and pipe | to grep because of -r
grep -hrio "\b\+@\+\.\{2,4\}\+\b" * > first.txt
^^ Need to grep the output... (14 Replies)