J'ai cette requête:fausses colonnes avec union et deux jointures internes?
SELECT * FROM (
(SELECT ACCOUNTS.INSTALLTIME, ACCOUNTS.HONAME, ACCOUNTS.ADDRESS, ACCOUNTS.CITY, ACCOUNTS.STATE, ACCOUNTS.ZIP, ACCOUNTS.JOBNUMBER, ACCOUNTS.INSTALLDATE, ACCOUNTS.RESULT, ACCOUNTS.NOTES, ACCOUNTS.SMNOTES, technicians.technumber, technicians.boardplacing
FROM ACCOUNTS
INNER JOIN technicians ON ACCOUNTS.INSTALLER = technicians.technumber)
UNION
(SELECT service.servicetime, service.Customername, service.address, service.city, service.state, service.zip, service.ID, service.serviceday, service.result, service.servicenotes, service.board, technicians.technumber, technicians.boardplacing
FROM service
INNER JOIN technicians ON service.technician= technicians.technumber)
) as t WHERE t.INSTALLDATE = '$date' ORDER BY t.boardplacing
est-il possible que je puisse faire une requête similaire à:
SELECT * FROM (
(SELECT ACCOUNTS.INSTALLTIME, ACCOUNTS.HONAME, ACCOUNTS.ADDRESS, ACCOUNTS.CITY, ACCOUNTS.STATE, ACCOUNTS.ZIP, ACCOUNTS.JOBNUMBER, ACCOUNTS.INSTALLDATE, ACCOUNTS.RESULT, ACCOUNTS.NOTES, ACCOUNTS.SMNOTES, '' as priority, ACCOUNTS.PAFS, ACCOUNTS.upsell, ACCOUNTS.TERM, ACCOUNTS.MMRUPGRADE, ACCOUNTS.WARRANTY, ACCOUNTS.EFT, technicians.technumber, technicians.boardplacing
FROM ACCOUNTS
INNER JOIN technicians ON ACCOUNTS.INSTALLER = technicians.technumber)
UNION
(SELECT service.servicetime, service.Customername, service.address, service.city, service.state, service.zip, service.ID, service.serviceday, service.result, service.servicenotes, service.board, '', '', '', '', '', '', technicians.technumber, technicians.boardplacing
FROM service
INNER JOIN technicians ON service.technician= technicians.technumber)
) as t WHERE t.INSTALLDATE = '$date' ORDER BY t.boardplacing
Fondamentalement, je besoin de fausses colonnes dans mon syndicat. Y at-il un moyen de retirer cela avec les jointures? est-il un autre meilleur moyen de le faire?
Tant que le nombre de colonnes dans l'union correspond, cela devrait fonctionner. –
les colonnes correspondent, mais il me donne toujours: argument fourni n'est pas une ressource de résultat MySQL valide – mlebrun15
Que dit mysql_error()? – Greg