[thelist] Quick SQL help

Matt Warden mwarden at gmail.com
Wed Mar 1 16:51:42 CST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

James Conley wrote:
> What is the schema of the table(s)?
> If you table looks has columns for Order,SKU,Warehouse,and Location
> And an example row looks like [1234,ABC,2,A] ['A' being the Location
> field]
> And you want to select all rows that have "A" in the location then
> SELECT DISTINCT Order from table_name where Location='A'
> 
> Or
> 
> SELECT Order FROM table_name WHERE location='A' GROUP BY Order

I interpreted the problem as wanting all records related to an order
where at least one of the records in that order is in location A.

So, if order #1234 has 3 records, only 1 of which is from location A, he
wants all 3 of those records. But if order #1235 has 3 records, none of
which is from location A, then he wants 0 of those records.

Rob, can you confirm?

- --
Matt Warden
Miami University
Oxford, OH, USA
http://mattwarden.com


This email proudly and graciously contributes to entropy.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFEBiV+rI3LObhzHRMRAmzQAKClQ1T4kdVgXWwQNC8TJVlXT8rSYQCfQ6kI
wfBBcKA6c4nKpIcrGSI/rpg=
=+ecc
-----END PGP SIGNATURE-----



More information about the thelist mailing list