MyTechSupport.ca :: Your Computer Technical Resource Headquarters! MyTechSupport.ca :: Your Computer Technical Resource Headquarters!
HOME FORUMS RESOURCES & TOOLS ARTICLES ONLINE STORE ABOUT US
Computer Support Forums arrow Software Support arrow Database Problems arrow Topic: ACCESS - SQL
March 22, 2019, 09:46:01 PM
 

Home Forum Rules Help Search Mobile Version Login Register

Welcome, Guest. Please login or register.
Did you miss your activation email?
March 22, 2019, 09:46:01 PM

Login with username, password and session length
 
News
New  New Poll on our main page!
"My experience with Vista..."
  0 Members and 1 Guest are viewing this topic.
Pages: [1] Go Down Print
Author Topic: ACCESS - SQL  (Read 4007 times)
picada
Newbie
*

Karma: +0/-0
Offline Offline

Gender: Male
Posts: 7


Bookmark and Share

View Profile
« on: November 25, 2004, 02:24:57 PM »


PLEASE SUPPLY RELEVANT INFORMATION:
Operating System Version: Windows XP Sp1
Problem Application Name & Version:MS Access XP
Problem Hardware Make & Model:NA
Error Messages:NA



This is the problem. I have a patients database with all their data within. This means i have some tables, lots of queries, lots of forms, 1 or 2 reports and every form has it's own VBA module.
one of the tables has the patients problems ("tblProblemasIndividuais") and the following fields: NOP (the patient ID, numeric) and PAT (from 'pathology', plain text).
I have some patients who have 'diabetes' and 'hipertension'; this means they have a NOP (eg. 101, 102, ...) and a corresponding PAT (eg. 't89' --> type 1 diabetes; 't90' --> type 2 diabetes).
When i want to get all patients with diabetes i run a querie like:
SELECT NOP, PAT FROM tblProblemasIndividuais WHERE PAT='t89' OR PAT='t90'
and every thing works fine.
The problem appears when i want to know wich of this patients have drinking problems (PAT='p15') and also smoking problems (PAT='p17') and classify them as ND (Non-drinking) or D (Drinking) and (NS (Non-smoking) or S (Smoking).

Any suggestions on how to do it???
Waiting 4 ur precious help.Wink
Logged

 
Admin
Administrator
Hero Member
*****

Karma: +4/-0
Offline Offline

Gender: Male
Posts: 4898



Bookmark and Share

View Profile
« Reply #1 on: December 08, 2004, 06:46:27 PM »

Hi,

What exactly is the problem? Do you get an error message or are you having problems with the query?
Logged

Sylvain Amyot
http://www.mytechsupport.ca

If you like to concept of this site and want to help, click here to find out how.
picada
Newbie
*

Karma: +0/-0
Offline Offline

Gender: Male
Posts: 7


Bookmark and Share

View Profile
« Reply #2 on: December 10, 2004, 11:36:30 AM »

the problem is that i don't know exactly how to build the query. Ican extract exactly the patients with diabetes thru with the above query. Then i want to find those that are smokers (p17) and drinkers (p15) within this diabeticals recordset and classify them has NS / S or ND / D and also diabetes type 1 (t89) and Diab Type 2 (t90).
i tried to do this:
SELECT [tbl_PROBLEMAS SA
Logged

 
GuidoMarcel
Newbie
*

Karma: +0/-0
Offline Offline

Gender: Male
Posts: 1


Bookmark and Share

View Profile
« Reply #3 on: January 12, 2005, 10:50:56 PM »

Hi,
I first tried to make your SQL nicer with www.sqlinform.com . I saw that there is a syntax error after "INDIVIDUAIS].Problema)="t90"));". The semicolon is not allowed here. I removed it an formatted your SQL as shown in the first attached file (formatted_SQL.txt).

Then I tried to understand your query and my first idea is to change it a little like in the 2nd attached file (sql.txt)

Hope this helps


Download Attachment: formatted_SQL.txt 1.31 KB
Right click and select Save Target As... then rename the file as shown here and save.

Download Attachment: sql.txt 1.4 KB
Right click and select Save Target As... then rename the file as shown here and save.
« Last Edit: January 13, 2005, 09:20:41 AM by GuidoMarcel » Logged

 
damaha
Newbie
*

Karma: +0/-0
Offline Offline

Gender: Male
Posts: 1


Bookmark and Share

View Profile
« Reply #4 on: June 10, 2005, 09:55:56 AM »

Free Online SQL Formatter

We have just release  a free  Online SQL Formatter
which can beautify different sql dialects for you on the fly with many format options.
and translate it to other languages such as C#, Java,Delphi

Try it here:
http://www.wangz.net/gsqlparser/sqlpp/sqlformat.htm
Logged

 
Pages: [1] Go Up Print 
 
Jump to:  

Powered by MySQL Powered by PHP

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines

Valid XHTML 1.0! Valid CSS!

Disclaimer
This site is NOT responsible for any damage that the information on this site may cause to your system. Everything you try, whether inspired by the response given from this site or not, is entirely at your own risk. All product names and company names used herein are for identification purpose only and may be trademarks or registered trademarks of their respective owners. We are in no way affiliated or representing any of the companies on this site unless specified.
Back to Top
Stop Spam Harvesters, Join Project Honey Pot Fight Back Against Spammers! Get Firefox! Get Thunderbird! View Sylvain Amyots profile on LinkedIn
Back to Top
Google visited last this page August 31, 2018, 01:23:29 AM