SQLite Forum

Using an alias in queries
Login
You show the full schema - which helps.

You do not however show a query that doesn't work, but in stead some Command-Line thing (I assume since that what you said you mean with "CL") that looks a lot like PHP/Pearl code to me and nothing like any command line I know (but I don't know all of them).

Do you have a normal query that doesn't work? Executed inside the sqlite CLI?

I can run your schema no problem but then I do not have the SQL that populates the data, though I could make that from the sample you sent, if I had the spare time.

The more complete you send your environment, the better we can help.

I will say this - From your code, on this line:  
```
$sth=$dbh->prepare(qq{ select count(keyword) as NUM,keyword from keywords group by keyword order by count(keyword) desc limit 5;});
```
You clearly limit the output to 5 rows with the "LIMIT 5" - why does it surprise you that only 5 rows are produced?
and in this line:  
```
print qq{records[0] $records[1] $SubColors[$ndx]n};
```
why do you say "$records[1]" but "records[0]" without the dollar sign? I don't know exactly what you are trying and that language may have nuances I am not familiar with, but my base understanding of programming leads me to believe the inconsistency would in fact cause different outputs.

Please give insert statements that put the same data in that DB than what you have (though it may well be less and perhaps obfuscated in case some of it is sensitive information), then a Query that you've tried that did not work. You have done well to explain what you expected to see from that query, though you have not stated exactly what you want to know from the data - perhaps another query might be better, but we can only help with that if we know what exactly you need to know from the data.


I know on many forums it is considered rude to be overly verbose, and it may be true of long-winded questions, but when it comes to the technical data, full code/schemata/queries are much more helpful and appreciated.