Re: Extremely complicated problem :(
From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 08/12/04
- Next message: Khurram Chaudhary: "Adding an extra record to a result set"
- Previous message: Gert-Jan Strik: "Re: Opinions on procedural language being introduced into SQL Server 2005"
- In reply to: zeyneddine: "Extremely complicated problem :("
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 12 Aug 2004 22:39:33 +0200
On Thu, 12 Aug 2004 11:11:02 -0700, zeyneddine wrote:
>Here's what I need to figure out from the following tables: I need to get -
>by Visit_id - the CPT4_code_id, cpt4_description (table - Claims_detail) and
>their associated charges, payments and adjustments + the payer name
(snip)
Hi zeyneddine,
What makes this problem complicated is that you provide lots of irrelevant
information (many of the columns in the DDL posted bear no relevance to
the problem), while at the same time omitting info that should have been
there, like constraints (you do have them, I hope) or a set of sample data
and expected output that might help peoplue not familiar with your line of
business understand what you're trying to achieve.
If you do want help writing the query, please provide the following info:
1. Table structure, posted as DDL (that is: CREATE TABLE statements,
complete with all constraints, but please omit columns that are irrelevant
to your question);
2. Sample data that is illustrative (*) of your problem. Please post the
sample data as INSERT statements that I can copy and paste into Query
Analyzer - otherwise, I can't test my solutions;
3. Expected output, based on the sample data given;
4. A description of the actual business problem you're trying to solve.
>As you can see, trans_detail.charge_id=charges.charge_id and
>charges.hin=network_payers.hin
No, that's something I can't see. I'm not familiar with your business and
you didn't post the FOREIGN KEY constraint that would have made this
obvious. See what I mean?
>Now the query to get the first part is:
>
>Select source_id, paid_amt, adj_amt, amt, service_item_id, cpt4_code_id,
>service_item_desc_40
>FROM trans_detail, charges
>Where trans_detail.charge_id=charges.charge_id
>AND paid_amt IS NOT NULL
>AND paid_amt > 0
>ORDER by source_id
>
>I am not even sure if thats right.
If you're not sure if that's right, wouldn't it be a good idea to test it
first? If it gets you the first part, you *know* it's right, if it
doesn't, you *know* it's wrong AND you can tell us where this query
produces output you don't want. Either way, it would be easier for us to
help you.
> Problem is how to relate to the
>Network_charts table. I am thinking of writing a subquery using the "hin"
>values of both the Charges and the Network_charts table.
>
>Can someone please assist me with that? PLEASE!!!
Without sample data and expected output, I'm afraid I have no idea how to
relate the network_charts table either.
Best, Hugo
-- (Remove _NO_ and _SPAM_ to get my e-mail address)
- Next message: Khurram Chaudhary: "Adding an extra record to a result set"
- Previous message: Gert-Jan Strik: "Re: Opinions on procedural language being introduced into SQL Server 2005"
- In reply to: zeyneddine: "Extremely complicated problem :("
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|