pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedLike Query help
3+ messages / 2 participants
[nested] [flat]
* Like Query help
@ 2021-01-15 00:27 Bret Stern <bret_stern@machinemanagement.com>
0 siblings, 1 reply; 3+ messages in thread
From: Bret Stern @ 2021-01-15 00:27 UTC (permalink / raw)
To: pgsql-general <pgsql-general@lists.postgresql.org>
query
select company_code, item_code, item_description, product_line,
udf_item_width, udf_item_length, sales_unit_measure, ''as mat_type from
mas_combined_item_master where company_code='BUR' or company_code='SNJ'
or company_code='EBC' and udf_edb_managed=''
and item_code LIKE 'S-%' order by item_code;
comment
Second column is item_code...why are these items in the results.
Expecting the query to return results where the item_code
starts with "S-" and includes any othervalue past "S-"
results
"SNJ";"000001 1X1 CORNER BULLNOSE";"1x1 Corner Double
Bullnose";"SYZY";"";"";"EACH";""
"SNJ";"0001 BRIGHT WHITE LISTELLO";"Bright White Listello
5/8x12";"VILL";"";"";"EACH";""
"SNJ";"0001 CUSTOM 1X6 BULLNOSE LONG";"Custom 1x6 Bullnose on 6"
Side";"SYZY";"";"";"EACH";""
"BUR";"000936MOD1P4";"Matte Cappuccino Tile";"AMOL";"";"";"SF";""
"SNJ";"000936MOD1P4";"Matte Cappuccino Tile";"AMOL";"";"";"SF";""
"BUR";"0009S4369MOD1P2";"Matte Cappuccino BN on 6"";"AMOL";"";"";"EA";""
"SNJ";"0009S4369MOD1P2";"Matte Cappuccino BN on 6"";"AMOL";"";"";"EA";""
"BUR";"0009S4639MOD1P2";"Matte Cappucino BN on 3"";"AMOL";"";"";"EA";""
"SNJ";"0009S4639MOD1P2";"Matte Cappucino BN on 3"";"AMOL";"";"";"EA";""
"BUR";"0009SCL4369M1P2";"Matte Cappuccino Left
Bullnose";"AMOL";"";"";"EA";""
"SNJ";"0009SCL4369M1P2";"Matte Cappuccino Left
Bullnose";"AMOL";"";"";"EA";""
"BUR";"0009SCR4369M1P2";"Matte Cappuccino Right BN";"AMOL";"";"";"EA";""
"SNJ";"0009SCR4369M1P2";"Matte Cappuccino Right BN";"AMOL";"";"";"EA";""
"SNJ";"0014 SURF 2X4 OFFSET";"Surf 2x4 Offset Mosaic";"VILL";"";"";"EACH";""
"SNJ";"0014 SURF LISTELLO";"Surf Listello 5/8x12";"VILL";"";"";"EACH";""
"SNJ";"0015 ICE 2X4 OFFSET";"Ice 2x4 Offset Mosaic";"VILL";"";"";"EACH";""
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Like Query help
@ 2021-01-15 00:37 aNullValue (Drew Stemen) <drew@anullvalue.net>
parent: Bret Stern <bret_stern@machinemanagement.com>
0 siblings, 1 reply; 3+ messages in thread
From: aNullValue (Drew Stemen) @ 2021-01-15 00:37 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
At 2021-01-14T19:27:23-05:00, Bret Stern <bret_stern@machinemanagement.com> sent:
> query
>
> select company_code, item_code, item_description, product_line,
> udf_item_width, udf_item_length, sales_unit_measure, ''as mat_type from
> mas_combined_item_master where company_code='BUR' or company_code='SNJ'
> or company_code='EBC' and udf_edb_managed=''
> and item_code LIKE 'S-%' order by item_code;
>
> comment
>
> Second column is item_code...why are these items in the results.
> Expecting the query to return results where the item_code
>
> starts with "S-" and includes any othervalue past "S-"
>
Based on your description, your query is not correct; you should rewrite it, likely using parenthesis to define your actually desired value expression.
See also https://www.postgresql.org/docs/13/sql-expressions.html#SYNTAX-EXPRESS-EVAL
This may or may not be what you intended:
SELECT company_code, item_code, item_description, product_line, udf_item_width, udf_item_length, sales_unit_measure, ''as mat_type
FROM mas_combined_item_master
WHERE (company_code='BUR' OR company_code='SNJ' OR company_code='EBC')
AND udf_edb_managed=''
AND item_code LIKE 'S-%'
ORDER BY item_code;
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: Like Query help
@ 2021-01-15 01:06 Bret Stern <bret_stern@machinemanagement.com>
parent: aNullValue (Drew Stemen) <drew@anullvalue.net>
0 siblings, 0 replies; 3+ messages in thread
From: Bret Stern @ 2021-01-15 01:06 UTC (permalink / raw)
To: pgsql-general@lists.postgresql.org
Works. Thanks for the help. I will read the docs
Best
On 1/14/2021 4:37 PM, aNullValue (Drew Stemen) wrote:
> At 2021-01-14T19:27:23-05:00, Bret Stern <bret_stern@machinemanagement.com> sent:
>> query
>>
>> select company_code, item_code, item_description, product_line,
>> udf_item_width, udf_item_length, sales_unit_measure, ''as mat_type from
>> mas_combined_item_master where company_code='BUR' or company_code='SNJ'
>> or company_code='EBC' and udf_edb_managed=''
>> and item_code LIKE 'S-%' order by item_code;
>>
>> comment
>>
>> Second column is item_code...why are these items in the results.
>> Expecting the query to return results where the item_code
>>
>> starts with "S-" and includes any othervalue past "S-"
>>
> Based on your description, your query is not correct; you should rewrite it, likely using parenthesis to define your actually desired value expression.
>
> See also https://www.postgresql.org/docs/13/sql-expressions.html#SYNTAX-EXPRESS-EVAL
>
> This may or may not be what you intended:
>
> SELECT company_code, item_code, item_description, product_line, udf_item_width, udf_item_length, sales_unit_measure, ''as mat_type
> FROM mas_combined_item_master
> WHERE (company_code='BUR' OR company_code='SNJ' OR company_code='EBC')
> AND udf_edb_managed=''
> AND item_code LIKE 'S-%'
> ORDER BY item_code;
>
>
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2021-01-15 01:06 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-01-15 00:27 Like Query help Bret Stern <bret_stern@machinemanagement.com>
2021-01-15 00:37 ` aNullValue (Drew Stemen) <drew@anullvalue.net>
2021-01-15 01:06 ` Bret Stern <bret_stern@machinemanagement.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox