0
I have the following query:
$qrysel = "select * from won_auctions w left join registration r on w.userid=r.id where payment_date!='0000-00-00 00:00:00'";
This query will show a list of users of the table won_auctions and take the user name in the table Registration.
The idea is that it checks how many records each user has in the table won_auctions during the current month, and the total.
The date can be checked by the column payment_date, and the user by the column userid, table won_auctions
In the case:
$total_arrematados = xxx;
$total_este_mes = xxx;
I created a table and thought about using while to show the results, only I need it to show only one line per user, not multiple lines for the same user.
I also need to sort to display those that have more records for the first, for the current month.
Structure won_auctions:
`id` int(11) NOT NULL AUTO_INCREMENT,
`auction_id` int(11) NOT NULL DEFAULT '0',
`accept_denied` varchar(100) NOT NULL DEFAULT '',
`userid` int(11) NOT NULL DEFAULT '0',
`won_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`accept_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`payment_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
`invoice_flag` enum('0','1') NOT NULL DEFAULT '0',
`situacaodescr` varchar(50) NOT NULL,
`dataenvio` datetime NOT NULL,
`rastreamento` varchar(100) NOT NULL DEFAULT '',
`lances_creditados` enum('SIM','NAO','REMOVIDO','') NOT NULL DEFAULT '',
`transacao_ps` varchar(35) NOT NULL DEFAULT '',
`cancelado` enum('SIM','NAO') NOT NULL DEFAULT 'NAO',
`cancelado_motivo` varchar(1000) NOT NULL DEFAULT '',
Structure Registration:
`id` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(100) NOT NULL DEFAULT '',
`firstname` varchar(100) NOT NULL DEFAULT '',
`lastname` varchar(100) NOT NULL DEFAULT '',
and where is the structure of the tables? Which fields are needed ? use
*
with aggregation functions will get complicated. If possible, access Sqlfiddle and assemble the database with some information to make it easier for those who try to help you– Rovann Linhalis
Sorry for the lack of information, I thought it was not necessary. I updated the question.
– Wendler
@Victor In fact he will add yes, will take all the values and add to tell me how many records there are in total and for the current month.
– Wendler
solved what I needed ?
– Rovann Linhalis
It worked out thank you :D
– Wendler