Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.