Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Help Guys! SQL problem (Access)

Status
Not open for further replies.

jocno1212

The Saint
Advanced Member
Messages
884
Reaction score
5
Points
28
Guys patulong naman, may dalawang table kasi ako, ang objective ko kasi e mapagsama sa iisang query yung lahat ng collection within the day galing sa dalawang tables ko,

example


Table1
ClientID........BillAmt.....DateRec
1..................50...........01/01/2016
2..................100.........01/01/2016

3..................150.........01/02/2016
4..................200.........01/03/2016
5..................250.........01/04/2016

Table2
ClientID........InstallationFee.....DatePaid
6..................1,000..................01/01/2016

Gusto ko sana maging ganito output ng QUERY ko

Query1
ClientID........BillAmt........InstallationFee....DateRec..................DatePaid
1..................50..............0........................01/01/2016............-
2..................100............0........................01/01/2016............-
6..................0................1,000................................................01/01/2016

Paano ba yung tamang SQL code nito,

Ano po ba mali dito?


SELECT
Table1.ClientID,
Table1.BillAmnt,
Table1.DateRec,
Table2.InstallationFee,
Table2.DatePaid,
FROM Table1 INNER JOIN Table2 ON Table1.ClientID = Table2.ClientID
WHERE Table1.DateRec=#01/01/2016# and Table2.DatePaid=#01/01/2016#

Patulong naman guys... any workaround? di na kaya ng utak ko eh, hehehe... Thanks in advance sa tutulong!

- - - Updated - - -

Up ko lang query ko...
 
UNION gamitin mo

SELECT clientId, billAmt, dateRec, '' `datePaid` FROM TABLE1 WHERE dateRec = 'yourdatehere'
UNION
SELECT clientId, installationFee, '', datePaid FROM TABLE2 WHERE datePaid = 'yourdatehere';

ididikit ng inner join ang table mo sa gilid, ididikit ng union ang table mo sa baba.
inner join (horizontal)
union (vertical) -> pero need mo na the same column count ang first query sa second query.
 
Last edited:
UNION gamitin mo

SELECT clientId, billAmt, dateRec, '' `datePaid` FROM TABLE1 WHERE dateRec = 'yourdatehere'
UNION
SELECT clientId, installationFee, '', datePaid FROM TABLE2 WHERE datePaid = 'yourdatehere';

ididikit ng inner join ang table mo sa gilid, ididikit ng union ang table mo sa baba.
inner join (horizontal)
union (vertical) -> pero need mo na the same column count ang first query sa second query.

Thanks boss. Laking tulong... Thanks so much!!!
 
Status
Not open for further replies.
Back
Top Bottom