If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Help with query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-14-05, 13:49
HunterK_mx HunterK_mx is offline
Registered User
 
Join Date: Dec 2005
Posts: 1
Question Help with query

Hello,everybody. I'm needing some help and am a complete newb to MySQL, so here I go.

I've just switched my DB from MS SQL Server 2000 to MySQL 5. I was using a query that looks like this:

select FlTdate Fecha, count(TotBoarded) Vuelos
from transactions
where TxnAmount = 0
and TotBoarded <> 0
and Origin = 'JFK'
group by all FltDate
having FltDate between '2005-10-16' and '2005-10-29'
order by FltDate

Notice the "group by all" line

When conditions are not fullfilled (everything under "where"), I get an empty row (a.k.a. nothing). But then, I need a zero on that row.

GROUP BY ALL worked in SQL Server 2000 (that is, I got a zero where there existed a date but was no data), but MySQL doesn't include this specific function.

Here, this example should make all this more understandable.

I'm getting this as result:

Fecha | Vuelos
2005-11-10 00:00:00 | 2
2005-11-11 00:00:00 | 2
2005-11-15 00:00:00 | 1


and I want to get this:

Fecha | Vuelos
2005-11-10 00:00:00 | 2
2005-11-11 00:00:00 | 2
2005-11-12 00:00:00 | 0
2005-11-13 00:00:00 | 0
2005-11-14 00:00:00 | 0
2005-11-15 00:00:00 | 1


Any ideas on how to do this?

Thx
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On