01-03-2011
Solved:
SELECT DISTINCT(x.city) FROM places x WHERE NOT EXISTS (SELECT 1 FROM places y WHERE y.name = 'bob' AND x.city = y.city);
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
How can i pick distinct records which consists of duplicate data from a ASCII file using UNIX commands (3 Replies)
Discussion started by: ss4u
3 Replies
2. Shell Programming and Scripting
this is a little more complex than that. I have a text file and I need to find all the distinct words that appear in a line after the word TABLESPACE
when I grep for just the word tablespace, I get:
how do i parse this a little better so i have a smaller file to read?
This is just an... (4 Replies)
Discussion started by: guessingo
4 Replies
3. UNIX for Dummies Questions & Answers
I am a beginner to scripting, please help me in this regard.
How do I create a script that provides a count of distinct values of all the fields in the pipe delimited file ? I have 20 different files with multiple columns in each file. I needed to write a generic script where I give the number... (1 Reply)
Discussion started by: vukkusila
1 Replies
4. Shell Programming and Scripting
I am a beginner to scripting, please help me in this regard.
How do I create a script that provides a count of distinct values of all the fields in the pipe delimited file ? I have 20 different files with multiple columns in each file. I needed to write a generic script where I give the number... (2 Replies)
Discussion started by: vukkusila
2 Replies
5. Shell Programming and Scripting
Hello ,
Can anyone help me with my below query
I am trying to find a text in directory of files via below command
grep -i cmps_cgs_crs_rfnc_id *
But it returns multiple times same file name i.e if the text found in a file 4 times the file name shown 4 times in the o/p
Is... (1 Reply)
Discussion started by: Pratik4891
1 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I have a file which looks like:
%_SPE_RDP_NUM_ECH(7)*************%
%_SPE_RDP_NUM_ECH(70)************%
%_SPE_RDP_NUM_ECH(71)************%
%_SPE_RDP_NUM_ECH(72)************%
%_SPE_RDP_NUM_ECH(8)*************%
%_SPE_RDP_NUM_ECH(9)*************%
%_SPE_FLUXPREV_PRES1_MT_HT(2)****%... (5 Replies)
Discussion started by: mvalonso
5 Replies
7. Shell Programming and Scripting
From the below ps output , I want the distinct values of the third field (ie. I need the distinct PPIDs)
$ ps -ef
UID PID PPID C STIME TTY TIME CMD
root 1 0 0 Nov 10 - 48:49 /etc/init
root 1769576 1 0 Nov 10 - 0:07... (1 Reply)
Discussion started by: polavan
1 Replies
8. Shell Programming and Scripting
Hi,
I have two files of the following format
file1
chr1:345-456
chr2:123-456
chr2:455-678
chr3:456-789
chr3:444-555
file2
chr1:345-456
chr2:123-456
chr3:456-789
output (2 Replies)
Discussion started by: jacobs.smith
2 Replies
9. Shell Programming and Scripting
Red Hat Enterprise Linux 5.4
I have a text file (error log file) , which has occurences of an error message like
ORA-01652: unable to extend temp segment by 8 in tablespace xxxxxThere are around 3000 error messages like this in the error log file. But there are only 7 or 8 distinct... (3 Replies)
Discussion started by: John K
3 Replies
LEARN ABOUT PHP
mysqli_sqlstate
MYSQLI_SQLSTATE(3) 1 MYSQLI_SQLSTATE(3)
mysqli::$sqlstate - Returns the SQLSTATE error from previous MySQL operation
Object oriented style
SYNOPSIS
string$mysqli->sqlstate ()
DESCRIPTION
Procedural style
string mysqli_sqlstate (mysqli $link)
Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. '00000' means no
error. The values are specified by ANSI SQL and ODBC. For a list of possible values, see http://dev.mysql.com/doc/mysql/en/error-han-
dling.html.
Note
Note that not all MySQL errors are yet mapped to SQLSTATE's. The value HY000 (general error) is used for unmapped errors.
PARAMETERS
o $
link -Procedural style only: A link identifier returned by mysqli_connect(3) or mysqli_init(3)
RETURN VALUES
Returns a string containing the SQLSTATE error code for the last error. The error code consists of five characters. '00000' means no
error.
EXAMPLES
Example #1
$mysqli->sqlstate example
Object oriented style
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s
", mysqli_connect_error());
exit();
}
/* Table City already exists, so we should get an error */
if (!$mysqli->query("CREATE TABLE City (ID INT, Name VARCHAR(30))")) {
printf("Error - SQLSTATE %s.
", $mysqli->sqlstate);
}
$mysqli->close();
?>
Procedural style
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s
", mysqli_connect_error());
exit();
}
/* Table City already exists, so we should get an error */
if (!mysqli_query($link, "CREATE TABLE City (ID INT, Name VARCHAR(30))")) {
printf("Error - SQLSTATE %s.
", mysqli_sqlstate($link));
}
mysqli_close($link);
?>
The above examples will output:
Error - SQLSTATE 42S01.
SEE ALSO
mysqli_errno(3), mysqli_error(3).
PHP Documentation Group MYSQLI_SQLSTATE(3)