Democratic Underground Latest Greatest Lobby Journals Search Options Help Login
Google

Raise your hand if you're an SQL or Access God. I need HELP desperately!

Printer-friendly format Printer-friendly format
Printer-friendly format Email this thread to a friend
Printer-friendly format Bookmark this thread
This topic is archived.
Home » Discuss » The DU Lounge Donate to DU
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 01:00 PM
Original message
Raise your hand if you're an SQL or Access God. I need HELP desperately!
It's frustrating enough having to wait for the answers!!!1
Printer Friendly | Permalink |  | Top
progressiveBadger Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 01:02 PM
Response to Original message
1. Not sure if I'm a god...
but I do work with SQL and Access fairly often.
Printer Friendly | Permalink |  | Top
 
Nicholas D Wolfwood Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 01:07 PM
Response to Reply #1
4. I have a question: how do I upload my access database
that has been exported to a text file (comma delimited, " text qualifier) to a SQL database?
Printer Friendly | Permalink |  | Top
 
LynneSin Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 01:15 PM
Response to Reply #4
6. Answer
File>>>>Get External Data>>>>Import

For file of type use the dropdown box to select Text Files (csv should be in there) and click on import

Now you'll get into the Import Wizard. For the csv file I import everyday on my job (which came from a SQL db), I do the following:

I use Delimited Width (then click Next)
Comma is usually the separtor and I always put a check in the First Row Contain Field Names (then click on Next)
You can either create a new table or export into a table you already have (then click on Next)
Now this section is important: If there are any fields in that CSV file that are dates, you need to change the 'data type' from Text to Date/Time. If you don't do that then Access won't treat those fields as date and you can't do a date search. You can use the horizontal scroll bar on the bottom to slide through and click on the fields you want to be date. Everything else you'll probably want to leave as Text
Always let Access add the primary key and then click finish.

Now, if you want to use this new table as a query, just go to the Query tab, selected "Create Query by using wizard" and then select your newly designed table. You'll move all the fields over so use the >> button and hit done. It'll give the query the same name as your table.

Hope that helpes!



Printer Friendly | Permalink |  | Top
 
Nicholas D Wolfwood Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 01:36 PM
Response to Reply #6
8. Thanks Lynne
As usual, you rule. :toast: :yourock:
Printer Friendly | Permalink |  | Top
 
Jo March Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 01:55 PM
Response to Reply #6
9. You beat me to it, LynneSin!
;)
Printer Friendly | Permalink |  | Top
 
LynneSin Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 02:14 PM
Response to Reply #9
12. I do this everyday - I could do it in my sleep
:shrug:
Printer Friendly | Permalink |  | Top
 
Jo March Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 02:30 PM
Response to Reply #12
15. Are you a DBA?
I'm a sys analyst now but used to develop Access and manage SQL dbs.
Printer Friendly | Permalink |  | Top
 
SaveElmer Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 01:03 PM
Response to Original message
2. Use them quite a bit
What's the question
Printer Friendly | Permalink |  | Top
 
sui generis Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 01:05 PM
Response to Original message
3. bring it on Hawkeye
minor deity - mostly parlor tricks actually, but SQL second language
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 01:08 PM
Response to Original message
5. Here is my problem.
I'm trying to covert the Excel code below to either
Expression Builder or SQL


Code:

=IF(SUM('CURRENT DMR'!F35)<>0,'CURRENT
DMR'!F35*8.34*'CURRENT DMR'!B35,"") 


Right now, 'CURRENT DMR'!F35 is equal to
[AvgInfluentBOD]![Expr1] and 'CURRENT DMR'!B35 is equal to
[AvgInfluent]![Expr1000]

This doesn't work when I try this code:

30daysBOD:
SELECT
IIf(Sum([AvgInfluentBOD]![Expr1])<>0,[AvgInfluentBOD]![Expr1]*8.34*[AvgInfluent]![Expr1000],"")
AS 30dayBOD;

An error comes out: 

You tried to execute a query that does not include the
specified expression" 'Iif(Not Sum(/)=0,
[AvgInfluentBOD]![Expr1]*8.34*[AvgInfluent]![Expr1000],
"")' as part of an aggregate function.

Some extra helps:

This is from AvgInfluentBOD: 
SELECT Avg([300I (Influent)]![BOD Lab mg/l]) AS Expr1,
Format(Date,"yyyy-mm") AS Expr2 
FROM [300I (Influent)] 
WHERE ((([300I (Influent)].Date) Between [Start Date] And [End
Date])) 
GROUP BY Format(Date,"yyyy-mm"); 

This is from AvgInfluent: 
SELECT Avg([Flow Data Calculations]![Influent Calc]),
Format(Date,"yyyy-mm") 
FROM [Flow Data Calculations] 
WHERE Date Between [Start Date] and [End Date] 
GROUP BY Format(Date,"yyyy-mm"); 

Hope this extra bit of info helps.


So any help would be greatly appreciated!

Hawkeye-X
Printer Friendly | Permalink |  | Top
 
sui generis Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 01:21 PM
Response to Reply #5
7. go into expression builder and change
Edited on Tue Aug-17-04 01:24 PM by sui generis
from "sum" to "expression" using the drop down menu on the grid interface. You may need to edit the expression and delete the "Sum(" and ")" after you change the grouping type to "Expression".

That should fix the problem. :propellerhead:

Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 02:17 PM
Response to Reply #7
13. Where is the grid interface
I'm using Access 2003, btw
Printer Friendly | Permalink |  | Top
 
NashVegas Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 02:19 PM
Response to Reply #5
14. If statements
Edited on Tue Aug-17-04 02:21 PM by Crisco
IIRC, IF statements don't belong in your SQL call - that is, assuming you're doing something for a web page. You get the stuff you need, and then use your coding language to display the results if they meet the requirements you're looking for.

ie, if the conditions you want are met, set a variable to be displayed. The statements you're using are a little complex for my ass, though, so ...
Printer Friendly | Permalink |  | Top
 
kiahzero Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 02:41 PM
Response to Reply #5
16. You've got a malformed query, I think
I've been working with MySQL recently, but I'm almost positive that the syntax is the same.

For a SELECT query:
SELECT <columns> FROM <table> WHERE <test>

Now, to your specific code:

=IF(SUM('CURRENT DMR'!F35)<>0,'CURRENT
DMR'!F35*8.34*'CURRENT DMR'!B35,"")


Let me make sure I understand what you're trying to do with this code:
If the sum of ! is not 0, set the value of the cell to 8.34*!*!.
Otherwise, set it to an empty string.

What are you trying to do with this code in access? Set a form value? Set a field value?
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 02:53 PM
Response to Reply #16
18. It's a field value.
=IF(SUM('CURRENT DMR'!F35)<>0,'CURRENT
DMR'!F35*8.34*'CURRENT DMR'!B35,"")

!F35 refers to a field value that is from Excel.

The current DMR!F35, in this case, is 329 (that's from Excel)

The current DMR!B35, in this case, is 1.480


So, I'm trying to get the result to show up as 4061 (rounded up)





Printer Friendly | Permalink |  | Top
 
kiahzero Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 03:06 PM
Response to Reply #18
19. Not quite what I meant
So, in Access, you're trying to calculate that value in a function?
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 03:22 PM
Response to Reply #19
20. I think so.
Hmm.
Printer Friendly | Permalink |  | Top
 
kiahzero Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 03:26 PM
Response to Reply #20
21. So, here's what I think you're going to need to do
I think you should probably create one or two queries to pull up the data you need from the database, then in the function you're doing this in, call those queries, and use that data to generate your value.

Did that help at all?
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 03:45 PM
Response to Reply #21
23. That is exactly what the
[AvgInfluentBOD] and [AvgInfluent] are --- they are previous
queries.

Hmm..

Printer Friendly | Permalink |  | Top
 
indigo32 Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 03:36 PM
Response to Reply #5
22. Hawkey
are these fields in an Access Database now?
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 03:46 PM
Response to Reply #22
24. Yes they are, indigo32
:)
Printer Friendly | Permalink |  | Top
 
indigo32 Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 04:02 PM
Response to Reply #24
25. What you've posted
is only a function that would be part of a query.
I can't see what other fields you are trying to select with it... and the error you are getting tells me you've got more data you are selecting.

SELECT
IIf(Sum(!)<>0,!*8.34*!,"")
AS 30dayBOD;

creates no relationship between the two queries first off, and the sum statement in the middle of the function is giving you a problem as well. You might want to sum in the original query AvgInfluent, or I could probably help you write the final query if I had more information.

Printer Friendly | Permalink |  | Top
 
LynzM Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 02:09 PM
Response to Original message
10. Can't help you with that one, specifically, but...
Check out this great resource:

www.experts-exchange.com

When I was learning Access/VB/SQL, I got more great help here. Amazing depth of knowledge and people willing to help! Good luck to you, SQL can be a #*$&# pain!
Printer Friendly | Permalink |  | Top
 
Hawkeye-X Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 02:13 PM
Response to Reply #10
11. but it costs me money!
*sob*
Printer Friendly | Permalink |  | Top
 
LynzM Donating Member (1000+ posts) Send PM | Profile | Ignore Tue Aug-17-04 02:46 PM
Response to Reply #11
17. Doesn't have to
I think you can ask a limited number of questions per month for no fee. You just can't search the archives, AFAIK. It really depends how much you'd use it... for me, at that time, the $10 was worth it.
Printer Friendly | Permalink |  | Top
 
DU AdBot (1000+ posts) Click to send private message to this author Click to view 
this author's profile Click to add 
this author to your buddy list Click to add 
this author to your Ignore list Fri Apr 19th 2024, 03:57 PM
Response to Original message
Advertisements [?]
 Top

Home » Discuss » The DU Lounge Donate to DU

Powered by DCForum+ Version 1.1 Copyright 1997-2002 DCScripts.com
Software has been extensively modified by the DU administrators


Important Notices: By participating on this discussion board, visitors agree to abide by the rules outlined on our Rules page. Messages posted on the Democratic Underground Discussion Forums are the opinions of the individuals who post them, and do not necessarily represent the opinions of Democratic Underground, LLC.

Home  |  Discussion Forums  |  Journals |  Store  |  Donate

About DU  |  Contact Us  |  Privacy Policy

Got a message for Democratic Underground? Click here to send us a message.

© 2001 - 2011 Democratic Underground, LLC