473,396 Members | 1,915 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

select row depending on column value

Hi Friends,

Table
-----

ID -- FId -- FVal
------------------
1 -- 15 -- 0
2 -- 15 -- 1
3 -- 16 -- 0
4 -- 16 -- 0
5 -- 17 -- 0
6 -- 17 -- 1
7 -- 17 -- 1

From this table values i want to take the
FId which has FVal =0 alone.

How can i get it?

Thanks,
Pimp
Apr 4 '07 #1
4 1854
Motoma
3,237 Expert 2GB
Expand|Select|Wrap|Line Numbers
  1. SELECT Fld FROM tableName WHERE FVal = 0
  2.  


Hi Friends,

Table
-----

ID -- FId -- FVal
------------------
1 -- 15 -- 0
2 -- 15 -- 1
3 -- 16 -- 0
4 -- 16 -- 0
5 -- 17 -- 0
6 -- 17 -- 1
7 -- 17 -- 1

From this table values i want to take the
FId which has FVal =0 alone.

How can i get it?

Thanks,
Pimp
Apr 6 '07 #2
Actually i made a mistake in the question..

I should have asked correctly..Its my mistake only

Let me tell the question again

ID -- FId -- FVal
------------------
1 -- 15 -- 0
2 -- 15 -- 1
3 -- 16 -- 0
4 -- 16 -- 0
5 -- 17 -- 0
6 -- 17 -- 1
7 -- 17 -- 1

I just need the values of FId which has only FVal =0

For Example:

I need the answer

3 -- 16 -- 0
4 -- 16 -- 0
5 -- 17 -- 0

Because FId 15 and 17 has FVal =0 and also FVal = 1
But FId 16 only has FVal = 0..

I think this is clear to you all now..

help me in this.


Thanks,
Scarlet
Apr 6 '07 #3
Motoma
3,237 Expert 2GB
It depends on the version of MySQL you are using, but something like this should work:

Expand|Select|Wrap|Line Numbers
  1. SELECT * FROM tableName WHERE fld IN
  2.   (SELECT Fld FROM tableName GROUP BY Fld HAVING SUM(FVal) = 0)
  3.  
Actually i made a mistake in the question..

I should have asked correctly..Its my mistake only

Let me tell the question again

ID -- FId -- FVal
------------------
1 -- 15 -- 0
2 -- 15 -- 1
3 -- 16 -- 0
4 -- 16 -- 0
5 -- 17 -- 0
6 -- 17 -- 1
7 -- 17 -- 1

I just need the values of FId which has only FVal =0

For Example:

I need the answer

3 -- 16 -- 0
4 -- 16 -- 0
5 -- 17 -- 0

Because FId 15 and 17 has FVal =0 and also FVal = 1
But FId 16 only has FVal = 0..

I think this is clear to you all now..

help me in this.


Thanks,
Scarlet
Apr 6 '07 #4
Thanks Motaoma...




Thanks,
Scarlet
Apr 7 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: lkrubner | last post by:
Are there any benchmarks on how much an extra, unneeded VARCHAR, CHAR, INT, BIGINT, TEXT or MEDIUMTEXT slows down a database call with MySql? PostGre info would also be useful. I'm trying to...
1
by: Luc | last post by:
I am using Visual Studio 2003 and am getting lousy performance after using a datatable select and then trying to assign a value to a column of the row that was found: DataTable dt = new...
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
1
by: Eric E | last post by:
Hi, I'm trying to write a recordset-returning function that returns a values from a base table, and one column from a joined table, where the joined table varies according to a field of the base...
16
by: ME | last post by:
In C# the following code generates a compiler error ("A constant value is expected"): public void Test(string value) { switch (value) { case SimpleEnum.One.ToString(): MessageBox.Show("Test...
33
by: Peter | last post by:
People are telling me it is bad to put select * from <atable> in a view. I better should list all fields of the table inside the definition of the view. I dont know exactly why but some...
3
by: David C | last post by:
Hi, I'm newbie on C#... Can anybody tell me with a code example how to make a select max(*) and put it on a variable. Thnks a lot! David C.
4
by: sade | last post by:
I want to select a column if data starts with a specific letter OR else to select from another column instead. Something like replacing columns. For example: 1st row to read columns ID, NAME if...
12
by: micarl | last post by:
How would i print a report based on criteria selected from several Combo Boxes as well as multiple Multi Select List Boxes, that are located on the same form? I can get one Multi List Box, just...
2
by: djnokturnal | last post by:
Hey guys / gals, First time posting and of course I am sure it is something that has been answered 100 times but for some reason I just cant find the answer :) First off here is the structure...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.