×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Select SQl query for more then 1 record

Select SQl query for more then 1 record

Select SQl query for more then 1 record

(OP)
There are 5 Accounts in a Table and want to get all sale transactions from sale table in one cursor of all five accounts through Select SQL .

e.g.
Accounts Table Name = [Acnts]

Sale Table Name = [SaleH]

Record1 Code = [00001AAA]

Record2 Code = [00002BBB]

Record3 Code = [00003CCC]

Record4 Code = [00004DDD]

Record5 Code = [00005EEE]

RE: Select SQl query for more then 1 record

The typical table structure of accounts and sales is having two tables accounts and sales.

To get all sales you only do SELECT * FROM sales, you may want to sort by account, but that even doesn't require a join or where clause.

What you give is two table names, so far so good. It's totally unclear to me, what you mean with RecordN Codes. Of which table?

So far you would only need to do

CODE

Select * From SaleH ORDER By Account && <--- adapt the field name within the [SaleH] table, which denotes the account of the sale transaction 
You might want to sum, you might want to order by transaction datetime, but that's not clear from your question and as you only give table names, we can't help you with details about that, not knowing fields of the tables.

Bye, Olaf.

RE: Select SQl query for more then 1 record

(OP)
Here requirement is merging of all transaction of all selected accounts selected by user to create 1 ledger of all selected accounts

so what technique will be applied to get all this merging

RE: Select SQl query for more then 1 record

Hi mstrcmtr,

You need to link the two tables on a common field (e.g. cID) and write a SQL statement similar to this

CODE -->

SELECT * FROM Acnts, SaleH JOIN SaleH ON Acnts.cID = SaleH.cID ORDER BY Acnts.cID WHERE ... (you add more filter criteria) INTO ... 

hth

MK

RE: Select SQl query for more then 1 record

You'll sum() group by account:

CODE

SELECT account, SUM(amount) FROM SalesH GROUP BY account ORDER BY account 

Again, not knowing your fields that's just the general idea. You might want to know the time span covered. Something along the lines of

CODE

SELECT account, SUM(amount), MIN(transactiondate) as startdate, MAX(transactiondate) as enddate FROM SalesH GROUP BY account ORDER BY account 

Bye, Olaf.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close