Jump to content

why query return value


sniperscope

Recommended Posts

Hello

I wonder why my query return value. It should be return 0 but it gives me 1 record with every value is null.

 

Here is my query


$today	= mktime(0, 0, 0, date("n"), date("d"), date("Y"));

SELECT s.register_date, s.shop_name, s.id, s.shop_type, s.shop_area, s.deli_area, s.shop_hour, s.shop_phone, g.staff_id, g.staffl_name, g.staff_recommend, c.course_course, n.news_icon, COUNT( n.news_id ) AS NewsNumber, COUNT( cp.coupon_id ) AS CouponNumber, COUNT( g.staff_id ) AS StaffNumber, COUNT( w.shukin_id ) AS ShukkinNumber
FROM shop_master s
LEFT JOIN course c ON s.id = c.shop_id
LEFT JOIN staff_master g ON s.id = g.shop_id
LEFT JOIN news_event n ON s.id = n.shop_id
LEFT JOIN coupon cp ON s.id = cp.shop_id
LEFT JOIN (

SELECT w.shop_id, w.shukin_id
FROM shukkin_master w
WHERE staff_date = '1334588400'
GROUP BY staff_master_id
)w ON s.id = w.shop_id
WHERE s.shop_area LIKE '%osaka%'
AND s.shop_type <> 'pizza'
ORDER BY g.staff_recommend DESC , n.news_date DESC , s.register_date DESC

 

This query MUST give me 0 record since there is no pizza shop.

 

I really appreciate for any help.

Link to comment
https://forums.phpfreaks.com/topic/261099-why-query-return-value/
Share on other sites

change it to = pizza

 

you see:

This query MUST give me 0 record since there is no pizza shop.

but your query is looking for every shop type that isn't pizza :

AND s.shop_type <> 'pizza'

 

it's not checking what you think it is, even though you know it's not.

Dear Muddy_Funster

Seems i didn't make my self clear.  :-[

I don't want to get pizza shops. I want to get NON-pizza shops

Shops may be flower shop, or restaurant, or night club but not pizza.

 

Pizza is just an example.

Simply user will select some shop from shop category dropdown menu

and i want to list every thing besides what he selected.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.