It's not like we all haven't done it.

I often alias ALL the fields in a SELECT statement, at least when I'm
starting out, to ensure I am grabbing the fields from the tables I
think I am. When I'm naming fields I tend to go back to the same
names, so it's not unusual to have an lActive in each table, or a
cName.


On Mon, May 18, 2015 at 5:50 PM, Joe Yoder <[email protected]> wrote:
> Thanks Ted and all for the help.  What I was overlooking is the fact that I
> was working with tables with long file names.  What was happening is that
> the cCategory field is actually in the Led table rather than the Cat table
> and the field I actually want is the cCat_Desc field in the Cat table.  I
> am working with files from a system I didn't design so I will be nice to
> myself and not call myself stupid this time but it better not happen again!
>
> Thanks again,
>
> Joe
>
> On Mon, May 18, 2015 at 4:10 PM, Ted Roche <[email protected]> wrote:
>
>> Joe:
>>
>> So, here's what you've told us:
>>
>> CREATE TABLE led (iledpk i autoinc, ddate d, icat_id i)
>> CREATE TABLE cat (icat_id i autoinc, cCategory c(20))
>>
>> FOR i = 1 TO 150
>>   INSERT INTO cat (cCategory) VALUES ("Category " + LTRIM(STR(i)))
>> NEXT
>>
>> FOR i = 1 TO 200
>>   FOR j = 1 TO 150
>>     INSERT INTO led (ddate, icat_id) VALUES (DATE()+i*j, j)
>>   NEXT
>> NEXT
>>
>> SELECT led.icat_id, ddate, cat.icat_id, cat.ccategory FROM led JOIN
>> cat ON led.icat_id=cat.icat_id
>>
>> So, I have 150 category records, and 30,000 ledger records and the SQL
>> query gives me 30,000 results, with all the cCategory fields filled
>> in.
>>
>> So, what is it you are not telling us? How does your situation differ
>> from the above?
>>
>>
>> On Mon, May 18, 2015 at 2:37 PM, Joe Yoder <[email protected]> wrote:
>> > I have a ledger table with about 23,000 records and a category table with
>> > about 150 records. Both tables have an integer iCat_Id field which I use
>> in
>> > the following code:
>> >
>> >   SELECT led.iCat_Id, ddate, Led.iCat_Id, cCategory;
>> >   FROM Led, Cat;
>> >   WHERE  Cat.iCat_Id = Led.iCat_Id
>> >
>> > The select comes back with about one third of the cCategory description
>> > fields empty.
>> >
>> > I searched for a specific value of iCat_Id in a browse and found the same
>> > value for records that included the description as well as the ones that
>> do
>> > no include the description.
>> >
>> > I thought perhaps VFP sees a difference between the values that work and
>> > the ones that don't so I scrolled through the file and compare iCat_id_a
>> > with iCat_Id_b with a "? iCat_Id_a = iCat_Id_b".  The results were alway
>> > true.
>> >
>> > I tried reindexing the tables and restarting VFP but the behavior
>> persists.
>> >
>> > Any suggestion will be welcome.
>> >
>> > Thanks in advance,
>> >
>> > Joe
>> >
>> >
>> > --- StripMime Report -- processed MIME parts ---
>> > multipart/alternative
>> >   text/plain (text body -- kept)
>> >   text/html
>> > ---
>> >
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/CACW6n4soN-Wmw=r0U9DZm60ksupQ0=rLcNbZRXG=i0wmgyi...@mail.gmail.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to