Jump to content

[TUT|SQL] Find stuff in your database


Recommended Posts

Posted

Hello,

If you want to find a row in a table you can use multiple SQL Queries. But.... Some people don't know this queries. So here are some.

 

I am using some of IPB-Row Names :steph:

 

So... If a table is this:

id|name|mgroup|posts

1 | DragonFly | 4 | 852

2 | Buster | 1 | 1

3 | zamg0d1 | 6 | 8244

 

You can look for a table with multiple options:

AND: This is saying that you need to have both of the options you filled in

OR: This is looking for just one of the two (or more) options you filled in.

 

If I fill this into a query:

SELECT *
FROM ibf_members
WHERE mgroup = "4" OR posts > 800

This will give me all the persons with a postcount above 800 or are in group 4. So this are DragonFly and zamg0d1.

 

If I fill this in:

SELECT *
FROM ibf_members
WHERE mgroup = "4" AND posts > 800

With this query I will get only DragonFly. Because he is the only person in the table with more posts then 800 and is in group 4.

 

If you want an alfabetic order of all your rows you can put in this:

SELECT *
FROM ibf_members
ORDER BY name

This will give this:

id|name|mgroup|posts

2 | Buster | 1 | 1

1 | DragonFly | 4 | 852

3 | zamg0d1 | 6 | 8244

You can see the names are in an alfabetic order :lol:

 

I hope you have some help with this tutorial :)

 

Greetz,

DragonFly

  • Management
Posted

Can you please post this tutorial in the tutorial section? (link above in the member bar)

 

This is an area for more generic questions not IP.Board related :)

Board Rules - Available Products - Need a Custom Work?

 

< Don't PM me for support, post in the forum or submit a ticket from the client area instead! >

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.