/    Sign up×
Community /Pin to ProfileBookmark

query problem

hi all,

i want to create a proper query to fetch the following.

table structure:

[U]key value ID[/U]

key1 value1 1
key2 value2 1
key3 value3 1
key4 value4 1
key5 value5 1
key6 value6 1
key1 value1 2
key2 value2 2
key1 value1 3
key2 value2 3

here i have key1-key6 and value1-value6 for ID 1, but i dont have key3-key6 for ID 2. now i need to get the ID which dont have the key3-key6. can anybody please help me?

Thanks

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@MrCoderApr 20.2007 — Can you explain it a bit better please Jeny?
Copy linkTweet thisAlerts:
@Suhas_DhokeApr 20.2007 — Hello Jeny.

You just want to fetch the records, which have only the [B]key1[/B] and [B]key2[/B] and where other fields are empty or not set.

Right ?

If YES, then try this query.

[code=php]SELECT * FROM table_name WHERE key1 != '' and key2 != '' and key3 == '' and key4 == '';[/code]

If you explain little bit more abt ur problem, then we will fix it.
×

Success!

Help @jeny spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...