You have to use "sub-selects", which go kinda like this:
Code:
select f.a, f.b, f.c, g.x
from
( select field1 a,
field2 b,
count(*) c
from mytable
group by field1, field2) f,
(select distinct field3 x
from mytable
where field1=f.a
and field2=f.c) g;
But I suspect that you may have a schema design problem instead.
hi everybody
i would to select the last field of a file
here as you can see i select the field number 8
y=`cat sortie2 | grep "^"| grep "starting"| awk '{ print $8}'`
but line can containt more or less field in never know, i just know is the last one
so i wondering to know if is... (3 Replies)
Hi
I have a Fixed format data file where I need to to get the total of the field at certain position in a file for a group of lines.
In this data file I need the total of all the field ats position 30:39 for each line starting with 6 and for each group startign with 5. Which means for... (27 Replies)
Hi,
Suppose if i am having a file with following records as given below.
5555
6756
5555
4555
4555
6767
how can i get the count of each record using AWK.
Eg:5555 count should be 2
4555 count should be 2
6767 count should be 1
... (5 Replies)
Hi Everyone,
I am facing a problem regarding the select from sybase, the return with the incorrect size.
For example, field is NAME(20).
After i selected from sybase, the result is nicky.
after i assign it to another declaration variable, it will be in actual name "nicky" , what i need... (10 Replies)
For a field format such as AAL1001_MD82, how do I select(and use in if statement) only the last four elements( in this case MD82) or the first three elements (in this case AAL)?
For instance, how do I do the following - if first three elements of $x == yyy, then ... (5 Replies)
When parsing multiple fields in a file using AWK, how do you group by one of the fields and parse by delimiters?
to clarify
If a file had
tom | 223-2222-4444 , randofield
ivan | 123-2422-4444 , random filed
... | and , are the delimiters ...
How would you group by the social security... (4 Replies)
Hi Team,
I have a requirement to login into URL using username and password , then I have to select a "particular name" from drop-down menu and then Read the values user records etc.... using perl.
Is it possible to do in perl script ? (OR) Can you please let me know which scripting... (1 Reply)
Hi,
I saw your post..
I have a dought in awk command...
how to get the output from a file. i need a first column in etc/passwd file in a single column (in indivijual line)...
i couldn't get with this command
cat /etc/passwd | awk -F ":" '{printf $1}'
Kindly help
This thread was created... (3 Replies)
Hello
I have a large file1 which has many events like "2014010420" and following lines under each event that start with text . It has this form:
2014010420 num --- --- num ....
NTE num num --- num...
EFA num num --- num ...
LASW num num --- num... (9 Replies)
Discussion started by: phaethon
9 Replies
LEARN ABOUT DEBIAN
sql::translator::schema::field
SQL::Translator::Schema::Field(3pm) User Contributed Perl Documentation SQL::Translator::Schema::Field(3pm)NAME
SQL::Translator::Schema::Field - SQL::Translator field object
SYNOPSIS
use SQL::Translator::Schema::Field;
my $field = SQL::Translator::Schema::Field->new(
name => 'foo',
table => $table,
);
DESCRIPTION
"SQL::Translator::Schema::Field" is the field object.
METHODS
new
Object constructor.
my $field = SQL::Translator::Schema::Field->new(
name => 'foo',
table => $table,
);
comments
Get or set the comments on a field. May be called several times to set and it will accumulate the comments. Called in an array context,
returns each comment individually; called in a scalar context, returns all the comments joined on newlines.
$field->comments('foo');
$field->comments('bar');
print join( ', ', $field->comments ); # prints "foo, bar"
data_type
Get or set the field's data type.
my $data_type = $field->data_type('integer');
sql_data_type
Constant from DBI package representing this data type. See "DBI Constants" in DBI for more details.
default_value
Get or set the field's default value. Will return undef if not defined and could return the empty string (it's a valid default value), so
don't assume an error like other methods.
my $default = $field->default_value('foo');
extra
Get or set the field's "extra" attibutes (e.g., "ZEROFILL" for MySQL). Accepts a hash(ref) of name/value pairs to store; returns a hash.
$field->extra( qualifier => 'ZEROFILL' );
my %extra = $field->extra;
foreign_key_reference
Get or set the field's foreign key reference;
my $constraint = $field->foreign_key_reference( $constraint );
is_auto_increment
Get or set the field's "is_auto_increment" attribute.
my $is_auto = $field->is_auto_increment(1);
is_foreign_key
Returns whether or not the field is a foreign key.
my $is_fk = $field->is_foreign_key;
is_nullable
Get or set whether the field can be null. If not defined, then returns "1" (assumes the field can be null). The argument is evaluated by
Perl for True or False, so the following are eqivalent:
$is_nullable = $field->is_nullable(0);
$is_nullable = $field->is_nullable('');
$is_nullable = $field->is_nullable('0');
While this is technically a field constraint, it's probably easier to represent this as an attribute of the field. In order keep things
consistent, any other constraint on the field (unique, primary, and foreign keys; checks) are represented as table constraints.
is_primary_key
Get or set the field's "is_primary_key" attribute. Does not create a table constraint (should it?).
my $is_pk = $field->is_primary_key(1);
is_unique
Determine whether the field has a UNIQUE constraint or not.
my $is_unique = $field->is_unique;
is_valid
Determine whether the field is valid or not.
my $ok = $field->is_valid;
name
Get or set the field's name.
my $name = $field->name('foo');
The field object will also stringify to its name.
my $setter_name = "set_$field";
Errors ("No field name") if you try to set a blank name.
full_name
Read only method to return the fields name with its table name pre-pended. e.g. "person.foo".
order
Get or set the field's order.
my $order = $field->order(3);
schema
Shortcut to get the fields schema ($field->table->schema) or undef if it doesn't have one.
my $schema = $field->schema;
size
Get or set the field's size. Accepts a string, array or arrayref of numbers and returns a string.
$field->size( 30 );
$field->size( [ 255 ] );
$size = $field->size( 10, 2 );
print $size; # prints "10,2"
$size = $field->size( '10, 2' );
print $size; # prints "10,2"
table
Get or set the field's table object. As the table object stringifies this can also be used to get the table name.
my $table = $field->table;
print "Table name: $table";
Returns the field exactly as the parser found it
equals
Determines if this field is the same as another
my $isIdentical = $field1->equals( $field2 );
AUTHOR
Ken Youens-Clark <kclark@cpan.org>.
perl v5.14.2 2012-01-18 SQL::Translator::Schema::Field(3pm)