Gossamer Forum
Home : Products : DBMan SQL : Discussion :

Selection Criteria for global

Quote Reply
Selection Criteria for global
Hi,

I'm looking for some help with a global I've cobbled together using other posts in the forum.

It selects DISTINCT vehicle manufacturers from the 'Salvage' database and orders them by the field 'Make'.

I'd like to add a second condition so that it will only select distinct manufacturers from records where the field "List" equals 'Y'?


sub {
my $db = $DB->table('Salvage');
$db->select_options('ORDER BY Make');
my $results = $db->select(['DISTINCT Make'])->fetchall_hashref;
return { loop_select => $results };
}

I basically want to add AND List like 'Y' to the select, but whatever I try seems to break it.

Any help appreciated Smile

All the best
Shaun
Quote Reply
Re: [qango] Selection Criteria for global In reply to
Just change a little bit:

my $results = $db->select({List => 'Y'}, ['DISTINCT Make'])->fetchall_hashref;

TheStone.


B.
Quote Reply
Re: [TheStone] Selection Criteria for global In reply to
Stone,

Thanks again for your help Smile

All the best
Shaun