1 Replies - 919 Views - Last Post: 12 December 2013 - 09:51 PM Rate Topic: -----

#1 terrymod  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 4
  • Joined: 30-December 08

Two fields in table 1 query from table 2 Not Executing

Posted 12 December 2013 - 08:44 PM

I am building an accounting transaction table and have a debit column and a credit column as follows. I have shortened the example for ease of discussion

<cfquery>
SELECT
trans.trans_id,
trans.db_chart_id,
trans.cr_chart_id,
charts.chart_id,
charts.chart

WHERE trans.DB_chart_id=charts.chart_id
and trans.CR_chart_id=charts.chart_id

ORDER BY trans_id

</cfquery>


Problem - only 1 line Where clause will work. Not Both in the out put at the same time.
Many thanks in advance,

Terry

Is This A Good Question/Topic? 0
  • +

Replies To: Two fields in table 1 query from table 2 Not Executing

#2 Craig328  Icon User is offline

  • I make this look good
  • member icon

Reputation: 1924
  • View blog
  • Posts: 3,462
  • Joined: 13-January 08

Re: Two fields in table 1 query from table 2 Not Executing

Posted 12 December 2013 - 09:51 PM

Hi Terry:

Although this is more of a basic SQL question rather than CF, we can give you a quick pointer.

Your example SQL lacks a FROM statement as well as JOIN of some variety. You can get some quick pointers here and if you don't make any progress there, feel free to drop your question to our experts in the DIC database forum.

Good luck!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1